unable to locate libxml2 when installing gem - ruby

Problem with install of twilio-ruby. I have installed libxml2 using homebrew and confirmed it is there. However when I try running
gem install twilio-ruby
I recieve an error that it cannot find libxml2. I have tried specifying the path to libxml2 but still can't get it to install. Any suggestions?
I have tried the following
gem install twilio-ruby -- --with-xml2-dir=/usr/local/Cellar/libxml2
gem install twilio-ruby -- --use-system-libraries
Then all of these three together:
gem install twilio-ruby -- --with-xml2-dir=/usr/local/Cellar/libxml2/2.9.1 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include
Each time I get output similar to the below.
gem install twilio-ruby -- --with-xml2-dir=/usr/local/Cellar/libxml2
Building native extensions with: '--with-xml2-dir=/usr/local/Cellar/libxml2'
This could take a while...
ERROR: Error installing twilio-ruby:
ERROR: Failed to build gem native extension.
/Users/tom/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb --with-xml2-dir=/usr/local/Cellar/libxml2
checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no
*** extconf.rb failed ***
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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/tom/.rvm/rubies/ruby-2.1.1/bin/ruby
--with-xml2-config
--without-xml2-config
--with-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
extconf failure: need libxml2.
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
extconf failed, exit code 1
Gem files will remain installed in /Users/tom/.rvm/gems/ruby-2.1.1#carecoach/gems/libxml-ruby-3.0.0 for inspection.
Results logged to /Users/tom/.rvm/gems/ruby-2.1.1#carecoach/extensions/x86_64-darwin-12/2.1.0-static/libxml-ruby-3.0.0/gem_make.out
'

So after much pain and frustration, and trying a bunch of stuff the solution was the following:
gem update --system
xcode-select --install # Then agree to the terms, even if you have done this before!

Related

After upgrading to macOS Mojave gem update is failing

Building native extensions. This could take a while...
ERROR: Error installing libxml-ruby:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.3.0/gems/libxml-ruby-3.1.0/ext/libxml
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20180926-80978-eoqfjh.rb extconf.rb
checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no
*** extconf.rb failed ***
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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/$(RUBY_BASE_NAME)
--with-xml2-config
--without-xml2-config
--with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
extconf failure: need libxml2.
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
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/libxml-ruby-3.1.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/libxml-ruby-3.1.0 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/libxml-ruby-3.1.0/gem_make.out
Updating nokogiri
Building native extensions. This could take a while...
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
The error is due to macOS Mojave has stopped placing the standard header files in /usr/include, keeping them only inside the XCode directory.
You can verify this by running ls /usr/include and most likely this directory does not exist anymore. On contrary, the usual trick by running xcode-select --install will not solve the problem.
The fix is to run legacy installer provided by Apple that will install the header files to /usr/include
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
If you are using homebrew, the recommended approach is to tell pkg-config where it can find the libxml2 library:
brew reinstall libxml2
export PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig"
Also, you may have outdated bundle config, which is in the way. Run bundle config build.nokogiri --use-system-libraries and it'll give you a warning and show what config you currently have. I was following all guides and reinstalled all gems and even ruby a few times only to find out that config was set to use a path that doesn't exist anymore.

Unable to install capybara-webkit with OS X Sierra

I've been trying to install the Capybara-Webkit gem with bundler and after following these instructions: https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit#macos-sierra-1012
I keep running into the error of the Makefile not being found. I've updated Homebrew, the gem system, and updated Xcode 8 with cli tools to no avail. Would really appreciate any help!
sudo gem install capybara-webkit PATH=/Users/caren/Qt5.5.1/5.5/clang_64/bin:$PATH gem install capybara-webkit
Password:
Building native extensions. This could take a while...
ERROR: Error installing capybara-webkit:
ERROR: Failed to build gem native extension.
/Users/caren/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20161108-5610-m00680.rb extconf.rb
*** extconf.rb failed ***
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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/caren/.rbenv/versions/2.2.3/bin/$(RUBY_BASE_NAME)
--with-gl-dir
--without-gl-dir
--with-gl-include
--without-gl-include=${gl-dir}/include
--with-gl-lib
--without-gl-lib=${gl-dir}/lib
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
Command 'qmake ' not available
extconf failed, exit code 1
Gem files will remain installed in /Users/caren/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/capybara-webkit-1.11.1 for inspection.
Results logged to /Users/caren/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/capybara-webkit-1.11.1/gem_make.out
ERROR: Could not find a valid gem 'PATH=/Users/caren/Qt5.5.1/5.5/clang_64/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Users/caren/.nvm/versions/node/v5.4.0/bin:/Users/caren/.rbenv/shims:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/heroku/bin:/usr/local/bin:/usr/local/sbin:/usr/local/share/npm/bin:/Users/caren/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin' (>= 0) in any repository
ERROR: Could not find a valid gem 'gem' (>= 0) in any repository
ERROR: Could not find a valid gem 'install' (>= 0) in any repository
ERROR: Possible alternatives: installr, instant, instana, instacli, instapi
Building native extensions. This could take a while...
ERROR: Error installing capybara-webkit:
ERROR: Failed to build gem native extension.
/Users/caren/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20161108-5610-97n2eh.rb extconf.rb
*** extconf.rb failed ***
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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/caren/.rbenv/versions/2.2.3/bin/$(RUBY_BASE_NAME)
--with-gl-dir
--without-gl-dir
--with-gl-include
--without-gl-include=${gl-dir}/include
--with-gl-lib
--without-gl-lib=${gl-dir}/lib
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
Command 'qmake ' not available
extconf failed, exit code 1
Gem files will remain installed in /Users/caren/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/capybara-webkit-1.11.1 for inspection.
Results logged to /Users/caren/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/capybara-webkit-1.11.1/gem_make.out
The following did the trick for me (using Homebrew):
brew install qt5 --with-qtwebkit
brew link --force qt5
gem install capybara-webkit
Note: It will take a while to install the first step, and you'll need to have Xcode installed.
I hope it will help someone.
brew install qt5 --with-qtwebkit
brew install qt#5.5 or brew reinstall qt#5.5
echo ‘export PATH=“/usr/local/opt/qt#5.5/bin:$PATH”’ >> ~/.bash_profile
source ~/.bash_profile
brew unlink qt#5.5 && brew link --force qt#5.5

Could not create Makefile for some reason - Trying to install Ruby Gem

I'm having some trouble installing a Ruby Gem called Lingust for my Mac. I get the error message below and have no idea how to solve the issue. Any help would be greatly appreciated.
gem install github-linguist
Building native extensions. This could take a while...
ERROR: Error installing github-linguist:
ERROR: Failed to build gem native extension.
/Users/kanery/.rvm/rubies/ruby-2.0.0-p643/bin/ruby -r./siteconf20151008-9054-b4exbs.rb extconf.rb
checking for gmake... no
checking for make... yes
checking for cmake... no
ERROR: CMake is required to build Rugged.
*** extconf.rb failed ***
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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/kanery/.rvm/rubies/ruby-2.0.0-p643/bin/ruby
--use-system-libraries
extconf failed, exit code 1
Gem files will remain installed in /Users/kanery/.rvm/gems/ruby-2.0.0-p643/gems/rugged-0.24.0b0 for inspection.
Reading the installation instructions of Rugged, you can see that both CMake and pkg-config are required. Looking at your error message, it seems like CMake is not installed on your system.
If you are using Homebrew, you can install it by running
brew install cmake
Or you can install it from the source following these instructions.

Try to install the vagrant-hostmanager

Im trying to install vagrant-hostmanager and suddenly this error appears and i have no clue why.
Would be nice if someone can help me!
im using Vagrant 1.6.5 and this is the errormessage:
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.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
checking for gzdopen() in -lz... no
zlib is missing; necessary for building libxml2
*** extconf.rb failed ***
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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby2.1
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
extconf failed, exit code 1
Gem files will remain installed in /home/eike/.vagrant.d/gems/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /home/eike/.vagrant.d/gems/extensions/x86_64-linux/2.1.0/nokogiri-1.6.6.2/gem_make.out
would be nice if someone can help me :-)
it complains about a missing native library zlib
on ubuntu, you can install with sudo apt-get install zlib and you should be fine to reinstall the plugin

Cannot gem install ruby-augeas on Ubuntu

I am trying to install augeas on Ubuntu.
sudo gem install ruby-augeas
This gives me the error:
Building native extensions. This could take a while...
ERROR: Error installing ruby-augeas:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
*** extconf.rb failed ***
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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby1.9.1
--with-augeas-config
--without-augeas-config
--with-pkg-config
--without-pkg-config
extconf.rb:27:in `<main>': augeas-devel not installed (RuntimeError)
I had
sudo apt-get install ruby1.8-dev ruby1.9.1-dev augeas-tools libaugeas-dev
Btw, where is the mkmf.log file?
How should I install augeas? I need to install it using gem as this will be used for Puppet's version of Ruby.
you need at least build-essential package to compile native extensions. Also make sure you have all the ruby base libraries precompiled (or in the rvm).
Try to install rvm itself, it will give you a list of required packages just after installation.

Resources