I'm a programmer specialising in performant and scalable systems using PHP and Ruby and cooking


Published:
On OSX | libxslt | libxml2

Nokogiri - slow install

The Nokogiri gem can seem to take a veeeerrryyy looooonnnnggg time to install. This is because by default it will attempt to compile libxml2 and/or libxslt.

You can however turn this off and instrcut it to use the system installed versions of these libs with:

env NOKOGIRI_USE_SYSTEM_LIBRARIES=true gem install nokogriri  

or with Bundler:

env NOKOGIRI_USE_SYSTEM_LIBRARIES=true bundle install  

Here is a quick demonstration of the significant difference it makes:

default install

~ $ time gem install nokogiri --no-ri --no-rdoc
Building native extensions.  This could take a while...  
Successfully installed nokogiri-1.6.1  
1 gem installed

real    1m23.797s  
user    0m52.995s  
sys    0m21.135s  

with system libs

~ $ time env NOKOGIRI_USE_SYSTEM_LIBRARIES=true  gem install nokogiri --no-ri --no-rdoc
Building native extensions.  This could take a while...  
Successfully installed nokogiri-1.6.1  
1 gem installed

real    0m10.167s  
user    0m5.689s  
sys    0m1.473s