4

I updated my OS about 2 weeks ago, and since then I've been running into this issue:

> ruby -v            
dyld: Library not loaded: /usr/local/opt/gmp/lib/libgmp.10.dylib
  Referenced from: /Users/me/.rvm/rubies/ruby-2.2.1/bin/ruby
  Reason: image not found
[1]    65487 trace trap  ruby -v

A solution found here (Ruby -v dyld: Library not loaded: /usr/local/lib/libgmp.10.dylib) works for each terminal session, but not permanently. I am running OS 10.9.5.

This is what works temporarily:

rvm reinstall 2.1.4

This has no effect, other than update homebrew:

brew update && brew install gmp 

How can I fix this permanently?

Community
  • 1
  • 1
user70848
  • 886
  • 1
  • 7
  • 19
  • Possible duplicate of [dyld: Library not loaded ... Reason: Image not loaded](http://stackoverflow.com/questions/17703510/dyld-library-not-loaded-reason-image-not-loaded) – kenorb Nov 25 '16 at 19:57

2 Answers2

6

You probably need to reinstall ruby, gmp and rvm packages to fix the broken dependencies, e.g.

brew reinstall gmp rvm ruby

Consider running brew update && brew upgrade before.

Then reinstall ruby as:

rvm reinstall 2.1.4 --with-opt-dir=$(brew --prefix gmp) --disable-binary

Then check by:

ruby -v

Make sure you're using the right ruby (check by: which -a ruby), if not, setup the right order for PATH variable in your startup shell scripts (e.g. ~/.bash_profile).

Also make sure you're not overriding any DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH or DYLD_FRAMEWORK_PATH variables from the startup shell scripts (e.g. ~/.bash_profile).

Related: Ruby installation issues with RVM.

Community
  • 1
  • 1
kenorb
  • 155,785
  • 88
  • 678
  • 743
0

A reinstall did it for me as well:

brew reinstall gmp ruby
Andreas K.
  • 389
  • 4
  • 17