Vagrant cannot install nokogiri-dependent plugins

I'm on OSX Mavericks and this worked for me:

Set as environment property:

NOKOGIRI_USE_SYSTEM_LIBRARIES=1 

Then install as usual:

vagrant plugin install vagrant-rackspace

Vagrant ships with embedded Ruby and isolated gem environment. So installing gems manually to your "normal" gem environment won't help.

The first issue is that you should never use sudo to run any vagrant command. If possible, please remove ~/.vagrant.d/ or at least chown it recursively back to your own user. You could also try upgrading Vagrant to v1.5.1.

Then please gist/pastebin the output of vagrant plugin install vagrant-rackspace --debug and ~/.vagrant.d/gems/gems/nokogiri-1.6.1/ext/nokogiri/mkmf.log.


The posted solutions didn't work for me. Instead I needed to specify the libxml2, libxslt and libiconv that I installed with homebrew (Do this first).

I installed the gem manually with the embedded ruby with the following [very concise] command line:

    /Applications/Vagrant/embedded/bin/gem install \ # select the embedded ruby
      --install-dir ~/.vagrant.d/gems \              # install to the vagrant dir
      nokogiri -v '1.6.2.1' -- \                     # pass options to nokogiri install
      --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2 \
      --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib \
      --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26 \
      --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include \
      --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib