Last week I couldn’t generate one of my websites with Jekyll. After some research I noticed that it was complaining about Nokogiri. I had the problem before, but I didn’t document it well enough so I had to troubleshoot the whole process again.
It seems that everytime I have an update, security or not, compiling of Nokogiri goes wrong.
I had all sorts of error messages:
- ERROR: Error installing nokogiri: ERROR: Failed to build gem native extension.
- Failed to build gem native extension. libxml2 version 2.6.21 or later is required!
and more I unfortunately didn’t write down.
Although the Nokogiri website had a good installation guide, it still didn’t work on my Mac.
After a lot of searching on the internet I found my solution: Compiling it to the libraries from brew.
First install the libraries with
and then compile it with:
If you are using bundle to run Jekyll you have to configure the build settings for Nokogiri with:
That did the trick for me. Now bundle installs Nokogiri without errors.