在 OSX 10.9 Mavericks 上初始 rails gem 安装时出现问题
Trouble with initial rails gem install on OSX 10.9 Mavericks
经过一番匆忙,我安装了 rbenv 和 ruby。当我尝试安装 rails 时,我在这里失败了:
$ gem install rails -v 4.2.3
[....]
checking for main() in -llzma... yes
checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
-----
libxml2 is missing. Please locate mkmf.log to investigate how it is failing.
-----
*** 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.
[....]
我使用 macports 进行包管理,似乎存在 libxml2(如我所料):
$ port list *libxml*
libxml @1.8.17 textproc/libxml
libxml2 @2.9.2 textproc/libxml2
libxmldiff @0.2.5 textproc/libxmldiff
libxmlxx @1.0.5 textproc/libxmlxx
libxmlxx2 @2.38.1 textproc/libxmlxx2
p5-libxml-enno @1.20.0 perl/p5-libxml-enno
p5-libxml-perl @0.80.0 perl/p5-libxml-perl
p5-xml-libxml @2.12.300 perl/p5-xml-libxml
p5-xml-libxml-simple @0.950.0 perl/p5-xml-libxml-simple
p5-xml-rss-libxml @0.310.500 perl/p5-xml-rss-libxml
p5.16-libxml-enno @1.20.0 perl/p5-graveyard
p5.16-libxml-perl @0.80.0 perl/p5-graveyard
p5.16-xml-libxml @2.12.300 perl/p5-graveyard
p5.16-xml-libxml-simple @0.950.0 perl/p5-graveyard
p5.16-xml-rss-libxml @0.310.500 perl/p5-graveyard
p5.18-libxml-enno @1.20.0 perl/p5-graveyard
p5.18-libxml-perl @0.80.0 perl/p5-graveyard
p5.18-xml-libxml @2.12.300 perl/p5-graveyard
p5.18-xml-libxml-simple @0.950.0 perl/p5-graveyard
p5.18-xml-rss-libxml @0.310.500 perl/p5-graveyard
p5.20-libxml-enno @1.20.0 perl/p5-graveyard
p5.20-libxml-perl @0.80.0 perl/p5-graveyard
p5.20-xml-libxml @2.12.300 perl/p5-graveyard
p5.20-xml-libxml-simple @0.950.0 perl/p5-graveyard
p5.20-xml-rss-libxml @0.310.500 perl/p5-graveyard
p5.22-libxml-enno @1.20.0 perl/p5-libxml-enno
p5.22-libxml-perl @0.80.0 perl/p5-libxml-perl
p5.22-xml-libxml @2.12.300 perl/p5-xml-libxml
p5.22-xml-libxml-simple @0.950.0 perl/p5-xml-libxml-simple
p5.22-xml-rss-libxml @0.310.500 perl/p5-xml-rss-libxml
py-libxml2 @2.9.2 python/py-libxml2
py24-libxml2 @2.9.2 python/py-graveyard
py25-libxml2 @2.9.2 python/py-graveyard
py26-libxml2 @2.9.2 python/py-graveyard
py27-libxml2 @2.9.2 python/py-libxml2
py34-libxml2 @2.9.2 python/py-libxml2
py35-libxml2 @2.9.2 python/py-libxml2
rb-libxml2 @2.3.4 ruby/rb-libxml2
当您键入 which libxml2
时,它应该 return 二进制文件的路径。
如果它没有在您的 ~/.bash_profile
中更新您的 $PATH
。一个快速的命令是:
echo 'export PATH="/opt/local/bin:/opt/local/sbin:$PATH"' >> ~/.bash_profile
后跟一个:
source ~/.bash_profile
我建议您切换到 Homebrew for package management on OSX along with a switch to RVM 进行 ruby 管理。
尝试将其安装为:
gem install rails -v 4.2.3 -- --use-system-libraries
经过一番匆忙,我安装了 rbenv 和 ruby。当我尝试安装 rails 时,我在这里失败了:
$ gem install rails -v 4.2.3
[....]
checking for main() in -llzma... yes
checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
-----
libxml2 is missing. Please locate mkmf.log to investigate how it is failing.
-----
*** 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.
[....]
我使用 macports 进行包管理,似乎存在 libxml2(如我所料):
$ port list *libxml*
libxml @1.8.17 textproc/libxml
libxml2 @2.9.2 textproc/libxml2
libxmldiff @0.2.5 textproc/libxmldiff
libxmlxx @1.0.5 textproc/libxmlxx
libxmlxx2 @2.38.1 textproc/libxmlxx2
p5-libxml-enno @1.20.0 perl/p5-libxml-enno
p5-libxml-perl @0.80.0 perl/p5-libxml-perl
p5-xml-libxml @2.12.300 perl/p5-xml-libxml
p5-xml-libxml-simple @0.950.0 perl/p5-xml-libxml-simple
p5-xml-rss-libxml @0.310.500 perl/p5-xml-rss-libxml
p5.16-libxml-enno @1.20.0 perl/p5-graveyard
p5.16-libxml-perl @0.80.0 perl/p5-graveyard
p5.16-xml-libxml @2.12.300 perl/p5-graveyard
p5.16-xml-libxml-simple @0.950.0 perl/p5-graveyard
p5.16-xml-rss-libxml @0.310.500 perl/p5-graveyard
p5.18-libxml-enno @1.20.0 perl/p5-graveyard
p5.18-libxml-perl @0.80.0 perl/p5-graveyard
p5.18-xml-libxml @2.12.300 perl/p5-graveyard
p5.18-xml-libxml-simple @0.950.0 perl/p5-graveyard
p5.18-xml-rss-libxml @0.310.500 perl/p5-graveyard
p5.20-libxml-enno @1.20.0 perl/p5-graveyard
p5.20-libxml-perl @0.80.0 perl/p5-graveyard
p5.20-xml-libxml @2.12.300 perl/p5-graveyard
p5.20-xml-libxml-simple @0.950.0 perl/p5-graveyard
p5.20-xml-rss-libxml @0.310.500 perl/p5-graveyard
p5.22-libxml-enno @1.20.0 perl/p5-libxml-enno
p5.22-libxml-perl @0.80.0 perl/p5-libxml-perl
p5.22-xml-libxml @2.12.300 perl/p5-xml-libxml
p5.22-xml-libxml-simple @0.950.0 perl/p5-xml-libxml-simple
p5.22-xml-rss-libxml @0.310.500 perl/p5-xml-rss-libxml
py-libxml2 @2.9.2 python/py-libxml2
py24-libxml2 @2.9.2 python/py-graveyard
py25-libxml2 @2.9.2 python/py-graveyard
py26-libxml2 @2.9.2 python/py-graveyard
py27-libxml2 @2.9.2 python/py-libxml2
py34-libxml2 @2.9.2 python/py-libxml2
py35-libxml2 @2.9.2 python/py-libxml2
rb-libxml2 @2.3.4 ruby/rb-libxml2
当您键入 which libxml2
时,它应该 return 二进制文件的路径。
如果它没有在您的 ~/.bash_profile
中更新您的 $PATH
。一个快速的命令是:
echo 'export PATH="/opt/local/bin:/opt/local/sbin:$PATH"' >> ~/.bash_profile
后跟一个:
source ~/.bash_profile
我建议您切换到 Homebrew for package management on OSX along with a switch to RVM 进行 ruby 管理。
尝试将其安装为:
gem install rails -v 4.2.3 -- --use-system-libraries