I'm trying to install ruby-filemagic.
I tried sudo gem install ruby-filemagic -v 0.2.2 and got:
ERROR: Error installing ruby-filemagic:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for magic_open() in -lmagic... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
...
According to this : http://blog.elctech.com/2009/08/31/installing-ruby-filemagic-on-macos-x-and-ubuntu/
I need the opt-dir setting. Opt is for mac ports right? And I'm using homebrew.
Any suggestions as to where to go from here would be great.
Installing directly from the gem still didn't work for me but the following command did: sudo env ARCHFLAGS="-arch x86_64" gem install ruby-filemagic -- --with-magic-include=/usr/local/include --with-magic-lib=/usr/local/lib/
you don't have to make your own formula, it's there in libmagic.
brew install libmagic
brew link libmagic
then, for whatever reason the gem install didn't work but cloning the lib and running
ruby extconf
make
make install
worked. godspeed!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With