问题
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?
回答1:
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.
回答2:
A reinstall did it for me as well:
brew reinstall gmp ruby
来源:https://stackoverflow.com/questions/34912946/how-to-fix-dyld-library-not-loaded-usr-local-opt-gmp-lib-libgmp-10-dylib-pe