Could not find directory of OpenSSL installation

Want to help support this blog? Try out Oh Dear, the best all-in-one monitoring tool for your entire website, co-founded by me (the guy that wrote this blogpost). Start with a 10-day trial, no strings attached.

We offer uptime monitoring, SSL checks, broken links checking, performance & cronjob monitoring, branded status pages & so much more. Try us out today!

Profile image of Mattias Geniar

Mattias Geniar, November 23, 2020

Follow me on Twitter as @mattiasgeniar

Ran into this error when compiling some software from source:

Could not find directory of OpenSSL installation, and this `-sys` crate cannot
proceed without this knowledge. If OpenSSL is installed and this crate had
trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
compilation process.

The fix is, luckily, rather easy.

Mac OSX / Homebrew

If you have Homebrew installed:

$ brew install openssl@1.1

Debian / Ubuntu

Using the apt package manager:

$ apt install pkg-config libssl-dev

Fedora / RHEL / CentOS

And using yum:

$ pkg-config openssl-devel

Or with the newer dnf package manager:

$ dnf install pkg-config openssl-devel


Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.