19

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?
jww
  • 97,681
  • 90
  • 411
  • 885
Ethan Keller
  • 963
  • 3
  • 10
  • 26
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. Also see [Where do I post questions about Dev Ops?](http://meta.stackexchange.com/q/134306). – jww Oct 06 '15 at 13:09
  • To answer your questions... (1) No, the development packages are not usually installed with the utilities. (2) Your distro normally provides them by way of a [`libssl-dev`](https://packages.debian.org/squeeze/libssl-dev) or `libssl-devel` package. You should probably ask about Homebrew package management on another forum, like [Super User](http://superuser.com/) or [Apple Stack Exchange](http://apple.stackexchange.com/). – jww Oct 06 '15 at 13:15
  • I'm voting to close this question as off-topic because this question is redundant with http://superuser.com/questions/982960/nginx-cannot-find-openssl-development-headers, which has been solved by the OP – UmNyobe Nov 23 '15 at 15:41
  • You may pass options to `configure` to help locate your openssl dev files. `--with-cc-opt="-I/usr/local/opt/openssl@1.1/include" --with-ld-opt="-L/usr/local/opt/openssl@1.1/lib"`. You have to tell passenger to let you customize the Nginx installation (when it asks you) and you will have the possibility to provide "Extra arguments to pass to configure script". – Ludovic Kuty Nov 19 '19 at 15:09

2 Answers2

55

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

A H K
  • 1,758
  • 17
  • 29
18

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
mani_007
  • 628
  • 7
  • 14
  • 1
    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? – Ethan Keller Oct 06 '15 at 13:54
  • 1
    If brew link openssl --force does not work anymore, try this link. https://solitum.net/openssl-os-x-el-capitan-and-brew/ Worked for me. – Nic128 Aug 10 '16 at 18:39
  • 12
    `$ 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 ` – A H K Nov 09 '16 at 16:06
  • After running all those commands, `which openssl` resulted in `/usr/bin/openssl` for me, not `/usr/local/bin/openssl` (on SierraOS). – user124384 Apr 22 '17 at 15:51
  • Curious: a) osx doesn't use openssl because of security b) osx doesn't include openssl. Is it (a) or (b) or (both) ? – kiranpradeep Jul 10 '17 at 09:09