Error while installing Nokogiri (1.6.7) on El Capitan

烈酒焚心 提交于 2019-11-28 03:39:32
Prasanna Sundar

You should install xcode-select packages first, then try installing nokogiri again. Try these commands,

xcode-select --install

then try

gem install nokogiri

with whatever Nokogiri version you want.

Nokogiri depends on multiple libraries like libxslt, libxml and zlib. Dev versions (including source) of these should be installed before installing Nokogiri in any Linux distribution. For OS X, the above command should work I guess.

The actual solution is in the comments below.

Try this :

gem install nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib/

And then run

bundle update

I hope this could help you :)

I you're using homebrew to maintain libraries like libml on your mac, the following command on your mac might help:


gem install nokogiri -v '1.6.8' -- --use-system-libraries --with-xml2-include=/usr/local/Cellar/libxml2/2.9.2/include/libxml2  --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.2/lib/

just ensure that the path for libxml is same as mine unless brew changes with the next version. You can check this by running the below command:


brew info libxml2
VKatz

Add gem "nokogiri", ">= 1.6.7.rc3" in your Gemfile

and then run

bundle install
Diego Medeiros

try to:

apt-get install ruby-nokogiri
bundle install

Thank you for posting this! I finally got nokogirl to run with bundle install correctly for my app after running the following:

bundle config build.nokogiri --use-system-libraries

Updating Xcode and Command Line Tools fixed all the errors for me. After that I could install Nokogiri with gem install nokogiri and after that gem install rails worked fine.

The following steps worked for me

ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]

Run the following to install RVM and the latest stable version of Ruby:
\curl -L https://get.rvm.io | bash -s stable --ruby

Install the Ruby interpreter:

rvm install 2.1.0 --autolibs=enable

After that's finished installing, run:

source /Users/{your_user_name}/.rvm/scripts/rvm
Run:

ruby -v
ruby 2.1.0p76 (2014-02-24 revision 45161) [x86_64-darwin13.0]


==> sudo gem install bundler
Fetching: bundler-1.14.6.gem (100%)
Successfully installed bundler-1.14.6
Parsing documentation for bundler-1.14.6
Installing ri documentation for bundler-1.14.6
Done installing documentation for bundler after 4 seconds
1 gem installed
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!