MacOS – How to make a clean install of OpenSSL on El Capitan

apachemacosopensslssl

I'm afraid I have made a mess with the version (0.9.8zg) of OpenSSL which was installed on my Mac. While I was trying to update it, now I have some error and for some reasons applications like Apache or Google Drive do not work anymore and they don't even start.

I would like to know which would be the best way to restore openssl to a working version without re-installing the whole operating system.

How can I do that?
Up to now I have tried to download openssl-0.9.8zg and build it with ./config, make and make install but it did not solve the problem.
Please help me if possible.

Update:

I downloaded openssl-0.9.8zg from the official site and I did the following:

./Configure darwin64-x86_64-cc --prefix=/usr
make
sudo make install

Now the commands outputs are:

$ openssl version
OpenSSL 0.9.8zg 11 Jun 2015
$ which openssl
/usr/bin/openssl
$ /usr/bin/openssl version
OpenSSL 0.9.8zg 11 Jun 2015
$ openssl version -a
OpenSSL 0.9.8zg 11 Jun 2015
built on: Wed Dec 30 19:50:01 CET 2015
platform: darwin64-x86_64-cc
options:  bn(64,64) md2(int) rc4(ptr,char) des(idx,cisc,16,int) idea(int) blowfish(idx) 
compiler: cc -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -arch x86_64 -O3 -fomit-frame-pointer -DL_ENDIAN -DMD32_REG_T=int -Wall
OPENSSLDIR: "/usr/ssl"

Still the problem persists.

These are some errors I get: for example, when trying to start Apache, it says:

Syntax error on line 111 of /Applications/MAMP/conf/apache/httpd.conf: Cannot load /Applications/MAMP/Library/modules/mod_ssl.so into server: dlopen(/Applications/MAMP/Library/modules/mod_ssl.so, 10): Symbol not found: _SSLv2_client_method
Referenced from: /Applications/MAMP/Library/modules/mod_ssl.so
Expected in: /usr/lib/libssl.0.9.8.dylib in /Applications/MAMP/Library/modules/mod_ssl.so

but libssl.0.9.8.dylib is present inside /usr/lib so I don't know why/what it does not find. Is it possible to fix this?

Or for example if I perform brew install libssl, I get:

Error: dlopen(/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin15/openssl.bundle, 9): Symbol not found: _SSLv2_client_method
Referenced from: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin15/openssl.bundle
Expected in: /usr/lib/libssl.0.9.8.dylib
in /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin15/openssl.bundle – /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin15/openssl.bundle

Moreover Google Drive won't start anymore

Best Answer

Not sure if this is a complete solution but OPENSSLDIR is pointing to the wrong place. Also various compilation instructions include the "shared" option.

So try this and let us know how you get on.

./Configure darwin64-x86_64-cc --prefix=/usr --openssldir=/System/Library/OpenSSL shared
make
sudo make install