Mavericks system Ruby and gem broken

2019-09-02 09:04发布

问题:

When I tried to run ruby -v or gem -v (or any other command), I get:

dyld: lazy symbol binding failed: Symbol not found: _ruby_run
  Referenced from: /usr/local/bin/ruby
  Expected in: /usr/lib/libruby.dylib

dyld: Symbol not found: _ruby_run
  Referenced from: /usr/local/bin/ruby
  Expected in: /usr/lib/libruby.dylib

This is after I ran rvm system to temporally switch to the system default Ruby. RVM is working fine, but I have a special need to install a gem to the system Ruby and I can't because of this problem.

Does anyone know why? It seems to be some kind of link problem to Ruby, but I'm don't know how to solve this.

I ran which ruby and it's at this point located in "/usr/local/bin/ruby".

I checked the Ruby in "/usr/lib/" and it's pointing to my system Ruby: "../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/lib/ruby"

Any help would be appreciated.

回答1:

The answer is Mavericks broke the homebrew installed Ruby. I just need to reinstall and force link it to make the error message go away.

In case anyone is interested, for CodeKit to work correctly using an external compass executable, just find your compass file, copy it over to /usr/bin, and point to it in the app.



回答2:

This worked for me. I changed the symbolic link for libruby back to lib ruby.1.8.6.dylib

$ sudo cp -p /usr/local/lib/libruby.1.8.6.dylib /usr/lib
$ cd /usr/lib
$ sudo rm libruby.dylib
$ sudo ln -s libruby.1.8.6.dylib libruby.dylib

If you need to go back to Ruby 2.0

$ sudo rm libruby.dylib
$ sudo ln -s libruby.2.0.0.dylib libruby.dylib