Nginx Cannot Find OpenSSL Development Headers

24,813

Solution 1

If brew link openssl --force gives you this message:

Warning: Refusing to link: openssl Linking keg-only openssl means you may end up linking against the insecure, deprecated system OpenSSL while using the headers from Homebrew's openssl. Instead, pass the full include/library paths to your compiler e.g.: -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib

Try this:

$ brew doctor (now fix anything that it tells you to fix)
$ brew update
$ brew upgrade

Now let's install it:

$ brew install openssl

And now we'll link it into our public area so you don't have to figure out the magic environment variable to set while building your favorite OpenSSL-backed library:

$ cd /usr/local/include
$ ln -s ../opt/openssl/include/openssl .

All done! Enjoy

Solution 2

If you are on Mac OS X El Capitan, Apple doesn't include openssl any more because of security problems openssl had, I have similar problem installing Passenger. brew just installs openssl itself without development headers.

If you are on an older version of Mac OS X than El Capitan, you can use: xcode-select --install which installs openssl development headers as well.

EDIT:

Updating brew and installing openssl and force linking openssl to brew version solved my problem:

$ brew update 
$ which openssl  
/usr/bin/openssl 
$ brew install openssl
$ brew link openssl --force 
$ which openssl 
/usr/local/bin/openssl
Share:
24,813
Ethan Keller
Author by

Ethan Keller

I've been reading a lot of Philip K. Dick.

Updated on November 10, 2020

Comments

  • Ethan Keller
    Ethan Keller over 3 years

    When I run: rvmsudo passenger-install-nginx-module on my Mac to install nginx, the terminal prints:

    Checking for OpenSSL development headers...
      Found: no
    

    But I am certain I have openssl installed. which openssl returns /usr/local/openssl/bin/openssl and /usr/local/openssl/bin: is the first entry in my $PATH. My questions are:

    • Are the OpenSSL development headers included with the regular openssl install through homebrew?
    • If they aren't, where should I download them from?
  • Ethan Keller
    Ethan Keller over 8 years
    I tried uninstalling with homebrew then reinstalling so that the terminal points to /usr/local/bin/openssl. But I still have the development headers marked as missing. Any other suggestions?
  • Nic128
    Nic128 over 7 years
    If brew link openssl --force does not work anymore, try this link. solitum.net/openssl-os-x-el-capitan-and-brew Worked for me.
  • A H K
    A H K over 7 years
    $ brew link openssl --force Warning: Refusing to link: openssl Linking keg-only openssl means you may end up linking against the insecure, deprecated system OpenSSL while using the headers from Homebrew's openssl. Instead, pass the full include/library paths to your compiler e.g.: -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib
  • Kirk Strobeck
    Kirk Strobeck over 7 years
    This should be the answer! :D
  • Admin
    Admin over 7 years
    Accepted answer is outdated.
  • user124384
    user124384 about 7 years
    After running all those commands, which openssl resulted in /usr/bin/openssl for me, not /usr/local/bin/openssl (on SierraOS).
  • kiranpradeep
    kiranpradeep almost 7 years
    Curious: a) osx doesn't use openssl because of security b) osx doesn't include openssl. Is it (a) or (b) or (both) ?