问题
I'm trying to run guard on Mac OS X Lion(XCode 4.3+OSX GCC Installer+Homebrew)
Error message:
Library not loaded: /opt/local/lib/libffi.5.dylib
I have no /opt/local
directory since I'm not using MacPorts but Homebrew
I tried brew install libffi
, which was successful, but the gem still doesn't work.
I also have tried uninstalling and reinstalling the gem without success.
Problem is also occurring on OSX 10.9 (Mavericks) with apple-gcc42
installed.
I have also tried telling gem
about the presence of libffi as follows:
gem install ffi:1.0.7 -- --with-ldflags='-L/usr/local/opt/libffi/lib'
回答1:
I have ended up in this situation after uninstalling MacPorts (I thought homebrew will be enough, but doesn't seem so). It stopped my cocoapods from updating/installing.
To make it work like a charm, I did:
$ sudo port install libffi
回答2:
With otool and install_name_tool, you may fix the dependency problem. See Creating working dylibs for detail.
回答3:
I'm using rvm, and I resolved it by reinstalling the ffi gem
gem uninstall ffi
gem install ffi ##or inside rails project folder run bundle install
回答4:
I think this is best explained as a compatibility issue between Mac OS X and older versions of the ffi gem. That is why in some cases simply uninstalling and reinstalling the gem can work.
In my case ffi version 1.0.7 was specified in a project's Gemfile. My tests failed with Library not loaded: /opt/local/lib/libffi.5.dylib
on that version, but if I tried latest version 1.9.3, it installed and worked without any fuss.
I was lucky and the need for that restriction on the project was placed years ago and no longer appears to be a requirement. So in the end I moved forward with later version of ffi gem.
I suspect there may be a way to get version 1.0.7 happily installed and working on OS X 10.9.2, but I do not know what that might be.
来源:https://stackoverflow.com/questions/9475287/library-not-loaded-opt-local-lib-libffi-5-dylib-but-im-using-homebrew