Brew update breaks openssl

Hello,

today I tried to install a new Ruby version through RVM, which triggered a brew update where a new openssl@1.1 version was installed and now I am unable to:

reinstall an old version of Ruby through RVM $ rvm reinstall 1.8.7-p374 does not work and throws:
Error running 'env CFLAGS=-I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl@1.1/include -O2 -fno-tree-dce -fno-optimize-sibling-calls LDFLAGS=-L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl@1.1/lib ./configure --prefix=/Users/MyAccount/.rvm/rubies/ruby-1.8.7-p374 --without-tcl --without-tk --disable-install-doc --enable-shared', please read /Users/MyAccount/.rvm/log/1578049283_ruby-1.8.7-p374/configure.log There has been an error while running configure. Halting the installation.

run Rails $ rails s does not work and throws:
[~]$ 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

I had to copy the content from /usr/local/Cellar/openssl/1.0.2q into /usr/local/Cellar/openssl@1.1/1.1.1d but that is not ideal.

I have added more details in a question on stackoverflow: Brew update breaks openssl

What did happen? How can I get the updated version of openssl to work?

Thanks!

brew doesn’t install rvm, so I’m not sure what the two have to do with each other.

There is no more openssl 1.0 available from Homebrew. Ruby 1.8.7 definitely needs it. Maybe there’s an answer for you here: https://github.com/rvm/rvm/issues/4819

Dear @gfguthrie thanks a lot for your answer. It pointed me into the right direction.

The point is that I had two different development systems with the same stack and the same tools installed (Homebrew, RVM, Ruby). But only on my Mac Pro the system broke after a brew update or brew upgrade.

I managed to find the culprit: the homebrew symlink for openssl was rerouted to openssl@1.1 instead of openssl. I recreated the openssl and a openssl@1.0 link and now everything works as before.

Maybe you can help me out for the future … to my knowledge Homebrew is a packagemanger which installs into usr/local, where Homebrew resides in usr/local/Homebrew and all the compiled applications in usr/local/Cellar. The symlinks to the active version of an application are written to usr/local/opt. I than can use a link to the opt directory in order to use the brew installed version instead of a system version for example.

Would that be appropriate for a basic knowledge?

Is there any place else where Homebrew writes data?

Thanks to your hint my dev system works again, but I still do not understand why the symlink for openssl was rerouted too and not only the one for openssl@1.1.

Is it right that I should look into the relative recipe?

Thanks again! In case you are interested and answer my stackoverflow question I will be more than happy to upvote it.

2 Likes

It’s because openssl doesn’t exist unversioned anymore. 1.0 has been deprecated and removed from homebrew.

Thanks @SMillerDev for your reply. I know 1.0 has been deprecated, but for a legacy dev environment I still need it.

Do you know why the generic openssl symlink has been overwritten on one system but not on the other system?

Is that normal behavior and intended?

I’d say pinned versions could have something to do with it since upstream the openssl formula doesn’t exist anymore.

I'm not an educated man, you know that, but I think I had a similar problem. I use rbenv 
instead of rvm. I fixed my development-environment by uninstalling rvm and installing 
rbenv.

rvm = ruby version manager
rbenv = ruby environment.

I might not know what I am talking about.

I have the same problem with rbenv.

$ gem install rubocop
ERROR:  Loading command: install (LoadError)
	dlopen(/Users/joaquin/.rbenv/versions/2.5.3/lib/ruby/2.5.0/x86_64-darwin18/openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /Users/joaquin/.rbenv/versions/2.5.3/lib/ruby/2.5.0/x86_64-darwin18/openssl.bundle
  Reason: image not found - /Users/joaquin/.rbenv/versions/2.5.3/lib/ruby/2.5.0/x86_64-darwin18/openssl.bundle
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass
joaquin-mba:aws joaquin$ rebenv exec gem install rubocop
-bash: rebenv: command not found
joaquin-mba:aws joaquin$ rbenv exec gem install rubocop
ERROR:  Loading command: install (LoadError)
	dlopen(/Users/joaquin/.rbenv/versions/2.5.3/lib/ruby/2.5.0/x86_64-darwin18/openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /Users/joaquin/.rbenv/versions/2.5.3/lib/ruby/2.5.0/x86_64-darwin18/openssl.bundle
  Reason: image not found - /Users/joaquin/.rbenv/versions/2.5.3/lib/ruby/2.5.0/x86_64-darwin18/openssl.bundle
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass
1 Like

Did you figure out the fix? I’m having the same problem… I don’t have rvm, so that’s not the problem.

Could you explain how what symlinks you created and how to set it.

I installed the older version and I am trying to switch it. HOwever it fails with
Error: openssl does not have a version "1.0.2t" in the Cellar.

when I run

ls -al /usr/local/opt/openssl*

This is the output

lrwxr-xr-x 1 m**** admin 31 Sep 11 16:11 /usr/local/opt/openssl@1.0.2t -> ../Cellar/openssl@1.0.2t/1.0.2t
lrwxr-xr-x 1 m**** admin 28 May 13 10:33 /usr/local/opt/openssl@1.1 -> ../Cellar/openssl@1.1/1.1.1g

brew switch only works with different versions of the same formula. openssl@1.1 and openssl@1.0.2t are entirely different formulae, so if you want to “switch” to the latter, do this instead:

brew unlink openssl@1.1
brew link openssl@1.0.2t