Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Brew update breaks openssl

today I wanted to install a new Ruby version through RVM and a homebrew update was triggered which broke OpenSSL.

[~]$ rvm install 2.7
.
.
.
No binary rubies available for: osx/10.14/x86_64/ruby-2.7.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Updating Homebrew...
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics

==> Auto-updated Homebrew!
Updated Homebrew from 1ea1f31d0 to c0b916764.
Updated 3 taps (homebrew/core, homebrew/cask and homebrew/services).
.
.
.
==> Upgrading 4 outdated packages:
coreutils 8.30_2 -> 8.31
libyaml 0.2.1 -> 0.2.2
[email protected] 1.1.1a -> 1.1.1d
readline 8.0.0 -> 8.0.1
==> Upgrading [email protected] 
==> Downloading https://homebrew.bintray.com/bottles/[email protected]
==> Downloading from https://akamai.bintray.com/10/104ef018b7bb8fcc49f57e5a60359a28a02d480d85a959e6141394b0571cbb28?__gda__=exp=1578044774~hmac=a692626c1c5fbcfeb1077551a60292afc273163879d04dc708c6051d0fc02d5a&response-content-disposition=attachment%3Bfilename%3D%22openssl%401.1
######################################################################## 100.0%
==> Pouring [email protected]
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/[email protected]/certs

and run
  /usr/local/opt/[email protected]/bin/c_rehash

[email protected] is keg-only, which means it was not symlinked into /usr/local,
because openssl/libressl is provided by macOS so don't link an incompatible version.

If you need to have [email protected] first in your PATH run:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
  export CPPFLAGS="-I/usr/local/opt/[email protected]/include"

For pkg-config to find [email protected] you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/[email protected]/1.1.1d: 7,983 files, 17.9MB
==> `brew cleanup` has not been run in 30 days, running now...
Removing: /usr/local/Cellar/[email protected]/1.1.1a... (7,953 files, 17.9MB)
Removing: /Users/MyAccount/Library/Logs/Homebrew/libdvdcss... (64B)
Pruned 0 symbolic links and 2 directories from /usr/local

When I try to run RAILS I get an openssl connected error:

[~]$ rails s
/Users/MyAccount/.rvm/rubies/ruby-x/lib/ruby/x/..../openssl.bundle: dlopen(/Users/MyAccount/.rvm/rubies/ruby-x/lib/ruby/x/..../openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError)
  Referenced from: /Users/MyAccount/.rvm/rubies/ruby-x/lib/ruby/x/..../openssl.bundle/openssl.bundle
  Reason: image not found - /Users/MyAccount/.rvm/rubies/ruby-x/lib/ruby/x/..../openssl.bundle/openssl.bundle

brew info openssl gives me:

[~]$ brew info openssl
[email protected]: stable 1.1.1d (bottled) [keg-only]
Cryptography and SSL/TLS Toolkit
https://openssl.org/
/usr/local/Cellar/[email protected]/1.1.1a (7,953 files, 17.9MB)
  Poured from bottle on 2019-02-11 at 09:38:06
/usr/local/Cellar/[email protected]/1.1.1d (7,983 files, 17.9MB)
  Poured from bottle on 2020-01-03 at 15:15:16
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/[email protected]
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/[email protected]/certs

and run
  /usr/local/opt/[email protected]/bin/c_rehash

[email protected] is keg-only, which means it was not symlinked into /usr/local,
because openssl/libressl is provided by macOS so don't link an incompatible version.

If you need to have [email protected] first in your PATH run:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
  export CPPFLAGS="-I/usr/local/opt/[email protected]/include"

For pkg-config to find [email protected] you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"

Somehow I have two openssl formulas installed in brew: openssl and [email protected]. Where openssl has version 1.0.2q and [email protected] versions 1.1.1a and 1.1.1d.

In my .bash_profile I have configured the path:

### Customize path for openssl
export PATH="/usr/local/opt/[email protected]/bin:$PATH"

Somehow I am unable to use the upgraded version of openssl: no way to update RVM, reinstall ruby, run rails. The only way I was able get it working is to delete the content of

/usr/local/Cellar/[email protected]/1.1.1d 

and copy instead the content of

/usr/local/Cellar/openssl/1.0.2q 

inside.

How can I get it running in a proper way?

Thank you in advance!!!

like image 511
SEJU Avatar asked Jan 03 '20 17:01

SEJU


1 Answers

Thanks to help from the discourse page on brew.sh I was able to find the cause of my problem.

The automatic update of brew and its formulas had overwritten not only the symlink for [email protected] but also the generic openssl link in /usr/local/opt. Both pointed now to /usr/local/Cellar/[email protected], whereas on my second dev system the openssl symlink pointed still to /usr/local/Cellar/openssl.

After I recreated the openssl symlink for /usr/local/Cellar/openssl everything works again.

The context is that openssl 1.1 is the safest version whereas 1.0 has been deprecated to my knowledge. But in my case it is only to maintain a legacy project in development.

Now I will have one more thing to do after every brew update/upgrade: verify symlinks, after the recent introduction of auto purging of old versions already forces me to copy them back into my system from a backup.

like image 173
SEJU Avatar answered Oct 19 '22 10:10

SEJU