在OSX 10.9 Mavericks上安装初始rails gem的麻烦

时间:2016-01-24 18:41:17

标签: ruby-on-rails macos rubygems osx-mavericks libxml2

经过一段时间后,我安装了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

2 个答案:

答案 0 :(得分:1)

尝试将其安装为:

gem install rails -v 4.2.3 -- --use-system-libraries

答案 1 :(得分:0)

当您键入UIView.animateWithDuration(0.5, delay:0, options:[.AllowUserInteraction], animations:{ () -> Void in cell.layer.transform = CATransform3DIdentity }, completion:nil) 时,它应该返回二进制文件的路径。

如果它没有更新which libxml2中的$PATH。快速命令是:

~/.bash_profile

然后是:

echo 'export PATH="/opt/local/bin:/opt/local/sbin:$PATH"' >> ~/.bash_profile

我建议您切换到Homebrew以便在OSX上进行包管理,并切换到RVM进行ruby管理。