41

I've been trying to run a script in the terminal and every time I do I get:

$ ruby directory.rb
dyld: Library not loaded: /usr/local/lib/libgmp.10.dylib
  Referenced from: /Users/claretrembath/.rvm/rubies/ruby-2.1.3/bin/ruby
  Reason: image not found
Trace/BPT trap: 5

I realized that when checking ruby -v I am given the same output:

$ ruby -v
dyld: Library not loaded: /usr/local/lib/libgmp.10.dylib
  Referenced from: /Users/claretrembath/.rvm/rubies/ruby-2.1.3/bin/ruby
  Reason: image not found
Trace/BPT trap: 5

Any ideas on how to resolve this?

1
  • It seems that when ruby is compiled, it will "opportunistically" link against gmp. This can be disabled with the configure script's --without-gmp option. In fact, this is what homebrew's ruby package does, as of Sep. 2019 (github.com/Homebrew/homebrew-core/pull/43841) Commented Feb 16, 2021 at 20:36

7 Answers 7

47

I just encountered similar issue and was able to resolve it following an answer from superuser.

brew update && brew install gmp && rvm reinstall 2.1.4

Seems this was an issue with libgmp.10.dylib.

Sign up to request clarification or add additional context in comments.

1 Comment

Image
Really the rvm reinstall isn't needed. At least in my case (same error message though).
36

For dyld: Library not loaded: /usr/local/lib/libgmp.10.dylib

you need brew update && brew install gmp

1 Comment

Seems like pretty poor form of the Ruby maintainers to require a third party math library and not mention it anywhere
1

I ended up solving this by including the brew's gmp directory when installing:

rvm install ruby-2.2.5 --with-opt-dir=$(brew --prefix gmp)

Comments

1

Mine was solved with:

brew update && brew install gmp
brew upgrade npm

Comments

0

I've solved this issue by installing libyaml and gmp via Homebrew on a self hosted GitHub actions server without the need for rvm or ruby using this command brew install gmp && brew install libyaml to fix an error in ruby/setup-ruby:

 warning: It seems your ruby installation is missing psych (for YAML output).
...
 Library not loaded: '/usr/local/opt/libyaml/lib/libyaml-0.2.dylib' (LoadError)

Comments

0

I solved with:

brew install libyaml 
brew install libffi       
asdf plugin-update ruby    
asdf install ruby latest or version

Comments

-3

Looks like it is an issue with upgrading the Ruby version.

Try:

$ brew rm cloog; brew install cloog 

This seems much like this similar issue: "Upgrading to Ruby 2.1.3 on Mac OSx 10.9.5"

Hope that works for you.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.