Skip to content

Instantly share code, notes, and snippets.

@mikdiet
Created April 16, 2019 12:35
Show Gist options
  • Select an option

  • Save mikdiet/7479956fd37d10abbf785b025457cd6a to your computer and use it in GitHub Desktop.

Select an option

Save mikdiet/7479956fd37d10abbf785b025457cd6a to your computer and use it in GitHub Desktop.
Libxml + ruby + rvm issue

I recently faced with error when reinstalled ruby and run bundle

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

...

Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

...

    Install the library or try one of the following options to extconf.rb:

      --with-xml2-config=/path/to/xml2-config
      --with-xml2-dir=/path/to/libxml2
      --with-xml2-lib=/path/to/libxml2/lib
      --with-xml2-include=/path/to/libxml2/include

Tried a lot of solutions from the Internet, but really helpuf was:

gem install libxml-ruby -v '3.1.0' -- --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config --with-xml2-dir=/usr/local/opt/libxml2 --with-xml2-lib=/usr/local/opt/libxml2/lib --with-xml2-include=/usr/local/opt/libxml2/include

PS. Helped second time again, when I upgraded ruby with rvm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment