I'm having a problem installing Ruby on Rails in my terminal.
Has anyone else encountered the following error in the terminal:
checking for main() in -llzma... yes
checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
-----
libxml2 is missing. Please locate mkmf.log to investigate how it is failing.
-----
*** 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.
I'm using the standard bash:
$ gem install rails
How would I go about fixing this? I've tried a few things here on stack exchange but nothing so far has worked...
Using $ brew list in the terminal yields:
Michaels-iMac:~ iMacHome$ brew list
autoconf libksba libxslt pkg-config
automake libtool libyaml readline
libgpg-error libxml2 openssl
Michaels-iMac:~ iMacHome$
It seems to be there...
assuming you have Xcode installed try this
gem install rails -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2 --use-system-libraries
The problem could be your RVM.
Try either this command:
rvm cleanup all
rvm pkg uninstall libxml2
rvm reinstall all --force
or upgrade/reinstall to the latest RVM installation.
--
To properly install the rails gem globally for a Ruby version:
rvm use <rubyversion>
gem install rails
example to use rails on ruby 2.1.5:
rvm use 2.1.5
gem install rails
Related
I am using cloud9.
I want to use gem 'rmagick', but using bundle, following error message occurs...
please help...
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/usr/local/rvm/gems/ruby-2.4.0/gems/rmagick-2.16.0/ext/RMagick
/usr/local/rvm/rubies/ruby-2.4.0/bin/ruby -r
./siteconf20180204-XXXXXX-oyXXpq.rb extconf.rb checking for gcc... yes
checking for Magick-config... no checking for pkg-config... yes
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc' to the
PKG_CONFIG_PATH environment variable No package 'MagickCore' found
checking for outdated ImageMagick version (<= 6.4.9)... * 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.
I just spun up a Cloud9 VM and tried it.
My Cloud9 VM I tried used yum as a package manager. Meaning I installed ImageMagick via sudo yum install ImageMagick-devel... when I did that my gem install rmagick worked.
Didn't try it with Bundler, but if gem install works then it should work in Bundler also.
Using the command prompt install/update imagemagick via
sudo apt-get update
Then
sudo apt-get install imagemagick
See more
Hope it helps
checking for libpq-fe.h... *** extconf.rb failed ***
Seems to be the issue, it's from this tail:
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/Users/elephanttrip/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/local/bin/pg_config
checking for libpq-fe.h... *** 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.
My steps to reproduce this on a Mountain Lion Mac OS is :
brew install postgresql
env ARCHFLAGS="-arch x86_64" gem install pg
I've tried to pinpoint different pg_config's through my computer. The one in Brew's cellar, the one cp'd by Brew to /user/local, and another one that might have been from a previous download of it. None of them work.
UPDATE
Just tried to install without the config-options. And got an lol:
ruby extconf.rb --without-pg-config
checking for pg_config... yes
I started imagining that my issue had something to do with RVM as the bottom of the trace it said.. :
"You need to download development tools"
Then I did :
$ rvm autolibs enable
$ rvm requirements
Then I went ahead and just updated my ruby ( if you don't do this, then I recommend just reinstalling it your current one. I could not do this without autolibs enable ) :
$ rvm install ruby-2.0.0-p0
Boom! Solved!!!! (:D :D :D :D :D) x 1,000,000
I'm trying to install an old version of nokogiri, but I am having trouble specifying the format:
I'm using
gem install nokogiri -v 1.5.2 -- --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
but this is not the correct syntax. Do you know how to do this?
ERROR
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/boris/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... no
-----
libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** 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:
You’ve only specified the lib dir to use, try specifying the include dir as well:
gem install nokogiri -v 1.5.2 -- \
--with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib \
--with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include
You may be able to specify both together:
gem install nokogiri -v 1.5.2 -- \
--with-iconv-dir=/usr/local/Cellar/libiconv/1.13.1
It looks like there was some changes as to how Nokogiri finds iconv between versions 1.5.2 and 1.5.5, which may explain why you’re able to install the latest version but not 1.5.2.
I simply installed homebrew, and used the brew link inconv to create the necessary symlinks to compile the gem.
$brew link libiconv
Linking /usr/local/Cellar/libiconv/1.13.1... 18 symlinks created
$gem install nokogiri -v 1.5.2
When I try to install nokogiri gem on ruby-1.8.7-p334 [ x86_64 ] on Mac OS X 10.6, I get the following error:
sudo gem install nokogiri
/Users/patelc75/.rvm/rubies/ruby-1.8.7-p334/bin/gem:4: warning: Insecure world writable dir /Users in PATH, mode 040777
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/patelc75/.rvm/rubies/ruby-1.8.7-p334/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... no
-----
libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** 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.
Before installing nokogiri gem, you need to get libraries installed.
Here are the steps to do it with homebrew
# the rest of this snippet assumes installation of libxml 2.7.7. YMMV.
brew install libxml2
brew link libxml2
# install libxslt from source
wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz
tar -zxvf libxslt-1.1.26.tar.gz
cd libxslt-1.1.26
./configure --prefix=/usr/local/Cellar/libxslt/1.1.26 \
--with-libxml-prefix=/usr/local/Cellar/libxml2/2.7.7
make
sudo make install
gem install nokogiri -- --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26
With macports
sudo port install libxml2 libxslt
sudo gem install nokogiri
More information here http://nokogiri.org/tutorials/installing_nokogiri.html
I tries all kinds of solutions I can found, including:
. use brew to install libxslt / libxml2 / libiconv
. tries to gem install with various --with-configurations
sadly, they all didn't work for me, until I uninstalled MacPort and all installed ports.
Then simply executed command gem install nokogiri, the gem and rdoc got installed like a breeze.
I don't understand the very details of why, but according to my own experiences of using MacPort (resulted in multiple sets of ruby/rake/gem(s) installed) and articles comparing brew and port, I will not go back to port.
when running a Rails server, I get the following error:
no such file to load -- openssl
I try a solution I find online. I go to ~/.rvm/src/ruby-1.9.2-head/ext/openssl. I type : ruby extconf.rb, but I get the following:
=== OpenSSL for Ruby configurator ===
=== Checking for system dependent stuff... ===
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for assert.h... yes
=== Checking for required stuff... ===
checking for openssl/ssl.h... no
=== Checking for required stuff failed. ===
Makefile wasn't created. Fix the errors above.
I cannot use make nor make install.
rvm pkg install openssl (older format - rvm package install openssl)
rvm pkg install iconv (older format - rvm package install iconv)
rvm remove 1.9.2
rvm install 1.9.2 -C --with-openssl-dir=$HOME/.rvm/usr,--with-iconv-dir=$HOME/.rvm/usr
Credit to http://www.isnull.com.ar/
check this instruction http://rvm.io/packages/openssl/ - keep in mind that the Quick fix is just one block not the whole page.
You have to install library for openssl/net/http run the following code and then install openssl and iconv.. Following code will work on UBUNTU..
sudo apt-get install libopenssl-ruby1.9.1 this is for ruby 1.9.1.
sudo apt-get install libopenssl-ruby for ruby 1.8.x
first check your rvm having the openssl package. Go to /usr/local/src/rvm/ruby-1.9.2-p290/
then go to ext/openssl.
type ruby extconf.rb
If we found errors like this
enter code here
=== OpenSSL for Ruby configurator ===
=== Checking for system dependent stuff... ===
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for assert.h... yes
=== Checking for required stuff... ===
checking for openssl/ssl.h... no
=== Checking for required stuff failed. ===
Makefile wasn't created. Fix the errors above
Then install apt-get install libssl-dev.Once installed rub ruby extconf.rb.Now the openssl will get installed
For ubuntu, I did the following:
apt-get install libssl-dev
cd ruby-1.9(source directory used to install ruby)/ext/openssl
ruby extconf.rb
make
make install
This solved the problem for me:
rvm pkg install openssl
rvm reinstall 1.9.2 --with-openssl-dir=$rvm_path/usr
And don't forget to change the ruby version to your version you are using. If you have an old rvm you may should update this at first too.
I made
rvm pkg install openssl
rvm reinstall 1.9.3
and done!
You might want to try running ruby-1.9.2-rc2 instead of head?
not sure if it will solve this issue or not, but I did have a lot of problems trying to run under head
pretty sure the the command would look like - rvm install 1.9.2-rc2
you will need to re-install rails again
This error means that your Ruby isn’t compiled with openssl.
Assuming that you use RVM, these are the steps to follow to fix this issue.
1.Install the openssl package
rvm pkg install openssl
2.Remove the Ruby installation you’re using
rvm remove 1.9.3
3.And finally recompile Ruby with openssl
rvm install 1.9.3 --with-openssl-dir=$HOME/.rvm/usr
4.Everything should be working now. Don’t forget to:
rvm use 1.9.3 --default
Try the below steps.
rvm get stable
brew install libyaml
rvm pkg install openssl
rvm install ruby-2.0.0 --with-openssl-dir=$HOME/.rvm/usr
rvm use ruby-2.0.0
if you already have ruby version use
rvm reinstall ruby-2.0.0 --with-openssl-dir=$HOME/.rvm/usr