On Yosemite, if you do bundle install, libxml2 is missing error during nokogiri installation

Asked 2 years ago, Updated 2 years ago, 36 views

The operating system is Yosemite.
When you enter a command about rails

Could not find Nokogiri-1.6.5 in any of the sources
Run `bundle install` to install missing gems.

If you do a bundle installation, you will get a libiconv, libxml2 is missing error.

gem install nokogiri

is installed successfully, but bundle installation is not possible.

checking if the C compiler accepts-Wno-error=unused-command-line-argument-hard-error-in-future...no
Building Nokogiri using system libraries.
checking for xmlParseDoc() in libxml/parser.h...no
checking for xmlParseDoc() in-lxml2...no
checking for xmlParseDoc() in-libxml2...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 rack of necessary
libraries and/or heads.Check the mkmf.log file for more details.You may need configuration options.
................................................
................................................
Error occurred while installing Nokogiri (1.6.5), and Bundler cannot continue.
Make sure that `gem install Nokogiri-v'1.6.5' `successes before bundling.

We also installed command line tools, libiconv and libxml2 respectively, and we also did a brew link.
I don't know what caused it, and I've been suffering from this error for about a week.

ruby-on-rails macos

2022-09-29 22:08

2 Answers

Looking at the error log, Bundler needs 1.6.5.

gem install nokogiri will get the latest gem, so 1.6.5 won't be installed?

Try installing it with gem install nokogiri-v'1.6.5' and the version as shown in the error log.

(By the way, you can see the version of nokogiri installed in gem search nokogiri-l.)

In , you will probably get a similar error when you try gem install nokogiri-v'1.6.5'.

In my case, if I want to install Nokogiri, I will install it with this option.

gem install nokogiri-v'1.6.5' ----use-system-libraries

If this doesn't work, try to find various information on the Internet.

For example, Qiita also has a lot of information about nokogiri install.

http://qiita.com/search?utf8=%E2%9C%93&sort=rel&q=nokogiri+install+libxml2+is+missing&sort=rel

Try searching the net with other keywords like "nokogiri yosemite 1.6.5 libxml2 is missing".


2022-09-29 22:08

You need to install missing development dependencies by:

xcode-select --install

See: gem install nokogiri-v'1.6.8.1'fails

For Ubuntu, see: nokogiri failing to upgrade.


2022-09-29 22:08

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.