32

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?

the Tin Man
  • 155,156
  • 41
  • 207
  • 295
czzt
  • 321
  • 1
  • 3
  • 3
  • consider marking answer if the solution solved your issue. – Jikku Jose Feb 06 '15 at 03:20
  • 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 (https://github.com/Homebrew/homebrew-core/pull/43841) – Jared Beck Feb 16 '21 at 20:36

5 Answers5

38

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.

Community
  • 1
  • 1
Jikku Jose
  • 17,604
  • 10
  • 38
  • 59
27

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

you need brew update && brew install gmp

newBike
  • 13,728
  • 26
  • 98
  • 169
  • 1
    Seems like pretty poor form of the Ruby maintainers to require a third party math library and not mention it anywhere – Andy Ray Oct 18 '18 at 01:03
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)

1

Mine was solved with:

brew update && brew install gmp
brew upgrade npm
Will
  • 10,736
  • 9
  • 66
  • 73
-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.

Community
  • 1
  • 1
cthomaspdx
  • 615
  • 5
  • 6