How to fix Nokogiri on Ubuntu? - ruby

I run Ubuntu 13.04 on my workstation with ruby 2.0.0, which was installed via RVM.
$ aptitude show libxml2
Package: libxml2
State: installed
Automatically instlled: no
Multi-Arch: same
Version: 2.9.0+dfsg1-4ubuntu4.1
$ aptitude show libxml2-dev
Package: libxml2-dev
State: installed
Automatically installed: no
Multi-Arch: same
Version: 2.9.0+dfsg1-4ubuntu4.1
$ aptitude show libxslt-dev
Package: libxslt1-dev
State: installed
Automatically installed: no
Version: 1.1.27-1ubuntu2
Priority: optional
$ nokogiri -v
WARNING: Nokogiri was built against LibXML version 2.9.0, but has dynamically loaded 2.8.0
# Nokogiri (1.6.0)
---
warnings:
- Nokogiri was built against LibXML version 2.9.0, but has dynamically loaded 2.8.0
nokogiri: 1.6.0
ruby:
version: 2.0.0
platform: x86_64-linux
description: ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-linux]
engine: ruby
libxml:
binding: extension
source: packaged
libxml2_path: /home/pb/.rvm/gems/ruby-2.0.0-p195/gems/nokogiri-1.6.0/ports/x86_64-linux-gnu/libxml2/2.8.0
libxslt_path: /home/pb/.rvm/gems/ruby-2.0.0-p195/gems/nokogiri-1.6.0/ports/x86_64-linux-gnu/libxslt/1.1.26
compiled: 2.9.0
loaded: 2.8.0
I installed nokogiri with the command, because else it's using libxml2 version 2.8.0, but I'm not sure where it takes this from, since just libxml2 is installed via apt.
gem install nokogiri -- --with-xml2-include=/usr/include/libxml2/libxml --with-xslt-dir=/usr/include/libxslt
When I run my application I get the following error:
/home/pb/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in require': /home/pb/.rvm/gems/ruby-2.0.0-p195/gems/nokogiri-1.6.0/ports/x86_64-linux-gnu/libxml2/2.8.0/lib/libxml2.so.2: versionLIBXML2_2.9.0' not found (required by /home/pb/.rvm/gems/ruby-2.0.0-p195/gems/libxml-ruby-2.6.0/lib/libxml_ruby.so) - /home/pb/.rvm/gems/ruby-2.0.0-p195/gems/libxml-ruby-2.6.0/lib/libxml_ruby.so (LoadError)
Can anyone tell me how I get rid of libxml2 version 2.8.0?
Thanks

Nokogiri is using its own version of libxml by default. Probably because Mac OS provides a version of libxml that is dated 2001 (!), and old libraries don't provide features Nokogiri depends on. However, this may cause a problem with the systems that are kept up-to-date. To resolve the problem you need to build Nokogiri against the libraries your OS provides.
This maybe something like this, it's from Arch Linux:
gem install nokogiri -- \
--with-xml2-include=/usr/include/libxml2/libxml \
--with-xml2-lib=/usr/lib \
--with-xslt-include=/usr/include/libxslt \
--with-xslt-lib=/usr/lib
You may need to install development packages if using distros like Ubuntu or Fedora. It should be libxml2-dev and libxslt1-dev on Ubuntu but correct me if I'm wrong.

Ultimately, this is the only thing that worked for me on 14.04
gem uninstall nokogiri
NOKOGIRI_USE_SYSTEM_LIBRARIES=1 bundle install # or use gem install instead

Ran across your question researching an issue of my own. It looks like, for a time, the nokogiri team was overriding the system install of libxml at gem install time as indicated in this comment: https://github.com/sparklemotion/nokogiri/issues/829#issuecomment-16877522. Not sure if that helps you, but it seems relevant. Perhaps a new version of Nokogiri is in order.

Try to reinstall it with system library.
gem install nokogiri -v 1.6.5 -- --use-system-libraries

Related

Installing Ruby on Rails latest version matching Ruby 3.0

When I try the following, after installing Ruby 3.0 from snap on Ubuntu 18.04::
gem install rails
I get this error:
/snap/ruby/201/lib/ruby/3.0.0/x86_64-linux/rbconfig.rb:13:in `<module:RbConfig>': ruby lib version (3.0.0) doesn't match executable version (2.5.1) (RuntimeError)
It was right after using
rails new rest-api-messages --api --database=postgresql
and trying to install PostGRES
gem install pg -v '1.2.3' --source 'https://rubygems.org/'
How could I solve this? is Ruby on Rails only for version 2.5.1 and lower?
edit: Then I got
Can't find the 'libpq-fe.h header when trying to install pg gem
Solved with
sudo apt-get install libpq-dev
Duplicate from Can't find the 'libpq-fe.h header when trying to install pg gem
My guess is you already had Ruby 2.5 installed and they are stepping on each other. Ruby versions don't overwrite each other. You need to uninstall Ruby 3.0 and 2.5 and install a Ruby version manager then install Ruby using it. This will also give you a path to move forward easily. Check out Ruby version manager like rbenv or RVM. Take a look at both. For what it's worth. I have used both and finally settled on rbenv.

can not install vagrant-vbguest

I am unable to install vagrant-vbguest on OS X 10.10.4, because it says it can't install Nokogiri.
I have:
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
Vagrant 1.6.2
VirtualBox 4.3.12
The maddening thing is that I do have nokogiri installed already:
> whereis nokogiri
/usr/bin/nokogiri
> /usr/bin/nokogiri -v
# Nokogiri (1.6.6.2)
---
warnings: []
nokogiri: 1.6.6.2
ruby:
version: 2.0.0
platform: universal.x86_64-darwin14
description: ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
engine: ruby
libxml:
binding: extension
source: packaged
libxml2_path: /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.6.2/ports/x86_64-apple-darwin14/libxml2/2.9.2
libxslt_path: /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.6.2/ports/x86_64-apple-darwin14/libxslt/1.1.28
libxml2_patches:
- 0001-Revert-Missing-initialization-for-the-catalog-module.patch
- 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch
libxslt_patches:
- 0001-Adding-doc-update-related-to-1.1.28.patch
- 0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch
- 0003-Initialize-pseudo-random-number-generator-with-curre.patch
- 0004-EXSLT-function-str-replace-is-broken-as-is.patch
- 0006-Fix-str-padding-to-work-with-UTF-8-strings.patch
- 0007-Separate-function-for-predicate-matching-in-patterns.patch
- 0008-Fix-direct-pattern-matching.patch
- 0009-Fix-certain-patterns-with-predicates.patch
- 0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch
- 0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch
- 0014-Fix-for-bug-436589.patch
- 0015-Fix-mkdir-for-mingw.patch
compiled: 2.9.2
loaded: 2.9.2
And I can reinstall it individually:
> sudo gem install nokogiri -v '1.6.6.2'
Building native extensions. This could take a while...
Successfully installed nokogiri-1.6.6.2
1 gem installed
And yet:
> sudo vagrant plugin install vagrant-vbguest
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:
An error occurred while installing nokogiri (1.6.6.2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.6.2'` succeeds before bundling.
Also:
> vagrant plugin update
Updating installed plugins...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:
An error occurred while installing nokogiri (1.6.6.2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.6.2'` succeeds before bundling.
It does look like the problem has nothing to do with nokogiri, but I was not able to find a solution.
Any ideas?
This question is quite old, but searchable. Vagrant is pluggable, and I expect it embeds Ruby, instead of working with the system Ruby you might use for scripting.
You shouldn't have to worry about Ruby gems anyway because you can install plugins right from your Vagrantfile:
# Install required plugins
required_plugins = %w( vagrant-vbguest )
plugin_installed = false
required_plugins.each do |plugin|
unless Vagrant.has_plugin?(plugin)
system "vagrant plugin install #{plugin}"
plugin_installed = true
end
end

Ruby and gem version compatibility

I had an SSH-session to some Ubuntu Server. The latest available Ruby package with -full was an apt-get install ruby1.9.1-full. But after apt-get install rubygems1.9.1 the problem was that:
root#...:~# gem install nokogiri
ERROR: Error installing nokogiri:
nokogiri requires Ruby version >= 1.9.2
And I didn't know, which version of Nokogiri I had to install. I tried to guess:
root#...:~# gem install nokogiri -v 1.5.10
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
..........bla..bla..bla...
and had to switch to RVM way (there I had 1.9.3 and no further problems with gems I needed).
But anyway I prefer non-RVM way, so the question is: How do I know, which version of the gem is compatible with my Ruby?
Inspecting from the CHANGLOG.rdoc of Nokogiri in its source:
1.6.0.rc1 / 2013-04-14
This release was based on v1.5.9, and so does not contain any fixes mentioned in the notes for v1.5.10.
Notes
mini_portile is now a runtime dependency
Ruby 1.9.2 and higher now required
Features
(MRI) Source code for libxml 2.8.0 and libxslt 1.2.26 is packaged with the gem. These libraries are compiled at gem install time unless the environment variable NOKOGIRI_USE_SYSTEM_LIBRARIES is set. VERSION_INFO (also `nokogiri -v`) exposes whether libxml was compiled from packaged source, or the system library was used.
(Windows) libxml upgraded to 2.8.0
Deprecations
Support for Ruby 1.8.7 and prior has been dropped
You may give the previous version a try, say 1.5.10 / 2013-06-07
For the errors of building native extension, you shall check the build log of Nokogiri. It's likely that your system missed some library dependencies, such as libxml, libyaml, etc. RVM may handle the dependency for you, in its manner, so you don't get error while building with RVM.

How to install gems over ruby 2?

I just installed ruby 2 on MacMountainLion, how to install gems? Actually I have both installed but there is something wrong. Maybe a fresh installation would solve.
macbook:~m$ gem install rails
ERROR: Loading command: install (LoadError)
cannot load such file -- openssl
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
macbook:~ m$ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.0]
macbook:~ m$ gem -v
2.0.3
macbook:~ m$
I had the same problem, but fixed it as follows:
Apparently OS X Mountain Lion has an older version of OpenSSL than Ruby 2 will tolerate. Download and install the latest OpenSSL using ./Configure darwin64-x86_64-cc --prefix=/usr/local --openssldir=/usr/local/openssl; make; sudo make install. Then build Ruby using ./configure --with-openssl-dir=/usr/local/openssl; make; sudo make install. Ruby's configure complains that --with-openssl-dir is an unknown option, but the build apparently uses it anyway because anything that depends on SSL, including gem installs, now works.
Installing gem like rails needs lot of dependent libraries which you have to download and install it manually
Alternatively you can try using Homebrew to install all the dependent libraries. If you are new to ROR development I strongly recommend you to use rvm to manage different versions of ruby
Once you have installed all the necessary dependent libraries using Homebrew then Its fairly straight forward to install a gem, execute the following after replacing "gemname" with the gem you are interested in
gem install <<gemname>>

Mac user and getting WARNING: Nokogiri was built against LibXML version 2.7.8, but has dynamically loaded 2.7.3

I have done all kinds of research and tried many different things. I know this question has been answered many times, but none of the suggested solutions are working for me.
After upgrading to Lion I am getting segmentation faults in Ruby. I'm fairly confident it's Nokogiri. So I installed libxml2 via Homebrew. I ran brew link libxml2. Then I reinstalled Nokogiri using that version of the library.
For proof:
$ nokogiri -v
# Nokogiri (1.5.0)
---
warnings: []
nokogiri: 1.5.0
ruby:
version: 1.9.2
platform: x86_64-darwin11.0.0
description: ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]
engine: ruby
libxml:
binding: extension
compiled: 2.7.8
loaded: 2.7.8
I've already included Nokogiri at the top of my gemfile and I've also required it in my environment file. I have no idea why I am still getting that warning.
Any suggestions or ideas to make sure it's loading the right version libxml2?
If you installed Nokogiri with gem install nokogiri, you can resolve this warning by running gem pristine nokogiri to recompile the gem's C extension.
If you installed Nokogiri with bundle install, you can resolve this warning by running bundle exec gem pristine nokogiri to recompile the C extension of the gem wherever Bundler installed it.
To fix this if you're using homebrew and bundler, add gem 'nokogiri' to the top of your Gemfile, then run these commands:
gem uninstall nokogiri libxml-ruby
brew update
brew uninstall libxml2
brew install libxml2 --with-xml2-config
brew install libxslt
bundle config build.nokogiri --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26/
bundle install
If you don't use bundler, run these commands instead:
gem uninstall nokogiri libxml-ruby
brew update
brew uninstall libxml2
brew install libxml2 --with-xml2-config
brew install libxslt
gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26/
In your app, you should require nokogiri first, to force the app to load the dynamic libxml2 library instead of the older system version of libxml2 loaded by gems that failed to specify which library to load.
I just spent the better part of the morning working through this warning. This fix is for people using Mac OS Lion. The fix above using
bundle config build.nokogiri --with-xml2-include=/opt/local/include/libxml2 --with-xml2-lib=/opt/local/lib --with-xslt-dir=/opt/local
is for Snow Leopard with libxml2 installed via MacPorts.
With Lion, libxml2 is loaded as part of the bootstrap process. Regardless of which libxml2 Nokogiri is pointing to, the Lion system default library for libxml2 will be used at runtime. Lion uses libxml2.2.7.3 found in /usr (not /usr/local).
As mentioned many other places, one can just ignore the warning. If, like me, the warning drives you crazy, you can do this:
bundle config build.nokogiri --with-xml2-dir=/usr --with-xslt-dir=/opt/local --with-iconv-dir=/opt/local
Interestingly, if you type nokogiri -v at the command line you will get the opposite warning:
WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
This suggests there is more to how libxml2 is being loaded, with Ruby and Rails using the system loaded libxml2 and the command line using libxml2 from the environment path. Anyway, this silences the error for me.
I’ll say it again – this is only for Lion. The previous fix will work for Snow Leopard.
This is the end of the answer. Stop reading here.
OK, you didn’t stop reading... well...
NOT RECOMMENDED!!!!!!
You have been warned. You can verify that Mac OSX is loading the libxml2 library in its bootstrap by disabling libxml2 found in /usr/lib. Do something like copying all versions of libxml2*.dylib to libxml2*.dylib.old (on my machine this was libxml2.2.7.3, libxml2.2 and libxml2).
After you have done this, running Nokogiri will not produce any errors. That is because it can’t find the loaded libxml2 and will now follow the environment path, eventually finding libxml2.2.7.8 in /opt/local.
BUT you won’t be able to copy the old libxml files back. This is because the OS needs the libxml2 that was loaded in the bootstrap.
Powering off and powering on again will brick your machine. The login screen will hang and hang and hang. Power off and power on again in single-user mode (hold Command-S while rebooting). You can watch the bootstrap occur. Low and behold, it throws an error that it can’t load libxml2 and then stops working.
Power off and power on again. This time boot into recovery mode (either hold Command-R or hold Option and then select the recovery disk). In recovery mode open the terminal (utilities/terminal). Mount /usr/lib on your HD (try /Volumes/Macintosh\ HD/usr/lib) and copy the libxml2 files back. Reboot and all will be fine.
None of this worked for me.
I had libxml2 installed at a later version (2.7.8) with brew. This caused nokogiri to compile against it and the later problems. Solution, remove it, then build, then install if desired.
Here's what worked:
brew uninstall libxml2 (if previously installed)
gem uninstall nokogiri
gem install nokogiri
brew install libxml2 (optional)
The solution (for me) after updating to Mountain Lion was much simplier:
gem uninstall nokogiri
# (and ignore the warnings about dependencies)
gem install nokogiri
As per the comment from patrickmcgraw above, simply putting nokogiri as the first entry in my Gemfile worked for me. I'm putting it as a separate answer because the original comment has been buried.
source 'http://rubygems.org'
gem 'nokogiri'
gem 'rails', '3.0.20'
etc...
Bundler has options to set the default build locations. So for instance, with libxml2 installed via macports:
$ bundle config build.nokogiri --with-xml2-include=/opt/local/include/libxml2 --with-xml2-lib=/opt/local/lib --with-xslt-dir=/opt/local
After doing this and bundle install, the warning went away.
There's also some helpful examples for setting build options on the nokogiri wiki.
Looks like you have updated your system libraries after installing the gem, so you have to update Nokogiri. To use the current lib version:
gem install nokogiri -- --use-system-libraries
I had similar problem and just solved this way:
In my case, I have RVM installed, and I had #global and #project gem sets.
Both of them had nokogiri installed and one of them had built with with different libxml.
Rebuilding both of them (I have reason to do this) solved the problem.
Hope this helps..
gem uninstall nokogiri
bundle #install nokogiri again
If that fails with "libxml2 is missing." and you see gems/nokogiri-1.5.0/ext/nokogiri/mkmf.log trying to use "/usr/bin/gcc-4.2 ...", then you're missing /usr/bin/gcc-4.2
Solution:
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
Before:
$ ll /usr/bin/gcc*
lrwxr-xr-x 1 root wheel 12 Jan 15 00:16 /usr/bin/gcc -> llvm-gcc-4.2
After:
$ ll /usr/bin/gcc*
lrwxr-xr-x 1 root wheel 12 Jan 15 00:16 /usr/bin/gcc -> llvm-gcc-4.2
lrwxr-xr-x 1 root wheel 12 Jan 15 21:07 /usr/bin/gcc-4.2 -> /usr/bin/gcc
If you're really missing libxml2 libxslt, then
brew update
brew install libxml2 libxslt
brew link libxml2 libxslt
bundle config build.nokogiri --with-xml2-include=/usr/local/Cellar/libxml2/2.8.0/include/libxml2/ --with-xml2-lib=/usr/local/Cellar/libxml2/2.8.0/lib/ --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26/
bundle
FYI: I'm running Mountain Lion with brew, and bundler.
gem install libxml-ruby helps me
I actually had 2 versions of libxml installed, one from source, one from an RPM.
The following is my complete solution
I uninstalled source (from the source directory)
sudo make uninstall
Remove bundles
rm -rf ~/.bundle ~/.bundler
Updated LD (might have to do this as root, not sudo)
sudo ldconfig
Then reinstalled the bundle
bundle install
Just ran into this myself (OS X Lion 10.7.5). My exact message was: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.7.3
I tried a few suggestions mentioned here, none worked, but this did:
gem install nokogiri -- --with-xml2-dir=/usr --with-xslt-dir=/opt/local --with-iconv-dir=/opt/local
The explanation is: "This happens because the Lion system default libxml2 (loaded at bootstrap) is used, regardless of which libxml2 Nokogiri was built against."
Credits to: https://coderwall.com/p/o5ewia
OS : Maverick 10.9.3
Ruby 1.9.3
WARNING: Nokogiri was built against LibXML version 2.9.1, but has dynamically loaded 2.9.0
My solution:
gem uninstall nokogiri
brew update
cd /usr/local
brew versions libxml2
git checkout 5dd45d7 /usr/local/Library/Formula/libxml2.rb # libxml version 2.9.0
brew install libxml2
bundle install or gem install nokogiri -v "1.5.11"
Hope this help
If you have this message and your nokogiri is out-of-date with the version available from the gem source, simply run bundle update nokogiri to get the new code and recompile. Your error should go away.
OS: Catalina
Warning: warning nokogiri was built against libxml version 2.9.10 but has dynamically loaded 2.9.4
I followed Michiel de Mare steps, but brew install libxml2 --with-xml2-config failed with invalid option error. So I installed libxml2 and libxslt and took note of the output from both commands.
brew install libxml2
==> Downloading https://homebrew.bintray.com/bottles/libxml2-2.9.10_2.catalina.bottle.tar.gz
Already downloaded: /Users/alberto/Library/Caches/Homebrew/downloads/9ddf5cb90fd16a7eb531e37bb748fd392f30214d9fe1568b2b70d28cc368c8f7--libxml2-2.9.10_2.catalina.bottle.tar.gz
==> Pouring libxml2-2.9.10_2.catalina.bottle.tar.gz
==> Caveats
libxml2 is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have libxml2 first in your PATH run:
echo 'export PATH="/usr/local/opt/libxml2/bin:$PATH"' >> ~/.zshrc
For compilers to find libxml2 you may need to set:
export LDFLAGS="-L/usr/local/opt/libxml2/lib"
export CPPFLAGS="-I/usr/local/opt/libxml2/include"
For pkg-config to find libxml2 you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig"
==> Summary
🍺 /usr/local/Cellar/libxml2/2.9.10_2: 280 files, 10.6MB
brew install libxslt
==> Downloading https://homebrew.bintray.com/bottles/libxslt-1.1.34.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/cbadecf3186f45754220dff4cbdfbb576882a211d615b52249a4c9d8ba4d7c3a?response-content-disposition=attachment%3Bfil
######################################################################## 100.0%
==> Pouring libxslt-1.1.34.catalina.bottle.tar.gz
==> Caveats
To allow the nokogiri gem to link against this libxslt run:
gem install nokogiri -- --with-xslt-dir=/usr/local/opt/libxslt
libxslt is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have libxslt first in your PATH run:
echo 'export PATH="/usr/local/opt/libxslt/bin:$PATH"' >> ~/.zshrc
For compilers to find libxslt you may need to set:
export LDFLAGS="-L/usr/local/opt/libxslt/lib"
export CPPFLAGS="-I/usr/local/opt/libxslt/include"
For pkg-config to find libxslt you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/libxslt/lib/pkgconfig"
==> Summary
🍺 /usr/local/Cellar/libxslt/1.1.34: 136 files, 2.8MB
And I used those directories when configuring bundle for nokogiri
bundle config build.nokogiri --with-xml2-include=/usr/local/opt/libxml2/include --with-xml2-lib=/usr/local/opt/libxml2/lib --with-xslt-dir=/usr/local/opt/libxslt
To summarize I executed these steps
gem uninstall nokogiri libxml-ruby
brew update
brew uninstall libxml2
brew install libxml2
brew install libxslt
bundle config build.nokogiri --with-xml2-include=/usr/local/opt/libxml2/include --with-xml2-lib=/usr/local/opt/libxml2/lib --with-xslt-dir=/usr/local/opt/libxslt
bundle install

Resources