尝试使用brew而非端口在Snow Leopard上安装ruby-filemagic [英] Trying to install ruby-filemagic on Snow Leopard using brew rather than ports

查看:81
本文介绍了尝试使用brew而非端口在Snow Leopard上安装ruby-filemagic的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装ruby-filemagic.

I'm trying to install ruby-filemagic.

我尝试了sudo gem install ruby​​-filemagic -v 0.2.2并得到:

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
...

据此: http://blog.elctech.com/2009/08/31/installing-ruby-filemagic-on-macos-x-and-ubuntu/

我需要opt-dir设置.选择适用于mac端口,对不对?而且我正在使用自制软件.

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.

直接从gem安装对我来说仍然不起作用,但是以下命令起作用了: sudo env ARCHFLAGS =-arch x86_64" gem install ruby​​-filemagic---with-magic-include =/usr/local/include --with-magic-lib =/usr/local/lib/

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/

推荐答案

您不必自行创建公式,它位于libmagic中.

you don't have to make your own formula, it's there in libmagic.

brew install libmagic
brew link libmagic

然后,无论出于何种原因,gem安装均无法正常运行,但会克隆lib并运行

then, for whatever reason the gem install didn't work but cloning the lib and running

ruby extconf
make
make install

工作.上帝!

这篇关于尝试使用brew而非端口在Snow Leopard上安装ruby-filemagic的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆