gemの依存関係ににnokogiriとかが入ってると、
普通に bundle install
したときに、libxml2が無いって怒られる。
あちこち調べると、Homebrewでlibxml2入れてそれ使う、ってでてくるけど。
どうやらXcodeにlibxml2が入ってるらしいので、brew link --force
とかで環境を汚したりはしたくない!
できるだけシステムのlibxml2を使いたい!!
環境
- MacOS X 10.10.2
- rbenv
- ruby 2.2.0
- Xcode Commandline toolsインストール済み
インストールしたいのは nokogiri (1.6.5)。
ちなみに記事を書いている時点でのnokogiriの最新は1.6.6.2。
やりかた
$ bundle config build.nokogiri --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2
$ bundle install --path vendor/bundle
bundle config
で、各gemのインストールオプションとか設定できるらしい。へー。