我试图安装ruby-filemagic。
我尝试过sudo gem install ruby-filemagic -v 0.2.2,但是出现了以下情况:
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
...
根据这篇文章:http://blog.elctech.com/2009/08/31/installing-ruby-filemagic-on-macos-x-and-ubuntu/ 我需要opt-dir设置。Opt是为Mac端口设置的,对吗?而我正在使用homebrew。
有没有建议从这里继续进行?
直接从gem安装仍然无法正常工作,但以下命令可以: sudo env ARCHFLAGS="-arch x86_64" gem install ruby-filemagic -- --with-magic-include=/usr/local/include --with-magic-lib=/usr/local/lib/