R.J. Robinson
R.J. Robinson

Reputation: 2240

Cant install rails

I have a new set up, and I keep getting an error when I am trying to install rails. I have used RVM to use ruby 2.2.2, and I have checked through the config files.

I have followed various tutorials. I have uninstalled gcc ( though i may reinstall xcode )

and I have gone through various tutorials on how to install this gem install rails [9:00:49] Building native extensions. This could take a while... ERROR: Error installing rails: ERROR: Failed to build gem native extension.

    /Users/rrobin008c/.rvm/rubies/ruby-2.2.2/bin/ruby -r ./siteconf20150812-28205-1wdgrip.rb extconf.rb
checking if the C compiler accepts -O2 -arch x86_64... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:

Building Nokogiri with a packaged version of libxml2-2.9.2
with the following patches applied:
    - 0001-Revert-Missing-initialization-for-the-catalog-module.patch
    - 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch

Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:

    gem install nokogiri -- --use-system-libraries
        [--with-xml2-config=/path/to/xml2-config]
        [--with-xslt-config=/path/to/xslt-config]

If you are using Bundler, tell it to use the option:

    bundle config build.nokogiri --use-system-libraries
    bundle install

Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.2.tar.gz into tmp/x86_64-apple-darwin14.4.0/ports/libxml2/2.9.2... OK
Running patch with /Users/rrobin008c/.rvm/gems/ruby-2.2.2/gems/nokogiri-1.6.6.2/ports/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch...
Running 'patch' for libxml2 2.9.2... OK
Running patch with /Users/rrobin008c/.rvm/gems/ruby-2.2.2/gems/nokogiri-1.6.6.2/ports/patches/libxml2/0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch...
Running 'patch' for libxml2 2.9.2... OK
Running 'configure' for libxml2 2.9.2... ERROR, review '/Users/rrobin008c/.rvm/gems/ruby-2.2.2/gems/nokogiri-1.6.6.2/ext/nokogiri/tmp/x86_64-apple-darwin14.4.0/ports/libxml2/2.9.2/configure.log' to see what happened.
*** 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/rrobin008c/.rvm/rubies/ruby-2.2.2/bin/$(RUBY_BASE_NAME)
    --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
/Users/rrobin008c/.rvm/gems/ruby-2.2.2/gems/mini_portile-0.6.2/lib/mini_portile.rb:279:in `block in execute': Failed to complete configure task (RuntimeError)
    from /Users/rrobin008c/.rvm/gems/ruby-2.2.2/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `chdir'
    from /Users/rrobin008c/.rvm/gems/ruby-2.2.2/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `execute'
    from /Users/rrobin008c/.rvm/gems/ruby-2.2.2/gems/mini_portile-0.6.2/lib/mini_portile.rb:66:in `configure'
    from /Users/rrobin008c/.rvm/gems/ruby-2.2.2/gems/mini_portile-0.6.2/lib/mini_portile.rb:109:in `cook'
    from extconf.rb:278:in `block in process_recipe'
    from extconf.rb:177:in `tap'
    from extconf.rb:177:in `process_recipe'
    from extconf.rb:475:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/rrobin008c/.rvm/gems/ruby-2.2.2/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /Users/rrobin008c/.rvm/gems/ruby-2.2.2/extensions/x86_64-darwin-14/2.2.0-static/nokogiri-1.6.6.2/gem_make.out

Upvotes: 0

Views: 875

Answers (5)

Tarun Rathi
Tarun Rathi

Reputation: 597

If you get to many error best thing to do is remove rails and ruby completely

first type this

tarun@tarun:~$ which ruby

/home/tarun/.rbenv/shims/ruby

tarun@tarun:~$ which rails

/home/tarun/.rbenv/shims/rails

then copy the path and use this command to remove the file

rm -rf /home/tarun/.rbenv/shims/ruby

rm -rf /home/tarun/.rbenv/shims/rails

and same way you can check which rbenv and which rvm and remove by using this same method.

And use

grep -rl rails
grep -rl ruby

this will show path of all files which have rails keyword.So that you can know that have you removed rails and ruby completely.

And follow steps given here to reinstall it https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-ubuntu-14-04

Upvotes: 0

Kaysser Kayyali
Kaysser Kayyali

Reputation: 1588

I would recommend running

brew doctor

rvm reinstall

rvm reinstall (ruby version here)

gem pristine all

sudo gem install rails

Upvotes: 0

R.J. Robinson
R.J. Robinson

Reputation: 2240

I went through the various tutorials and my output looked like this:

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

    /Users/rrobin008c/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150812-2574-6ejap3.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling breakpoint.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [breakpoint.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/rrobin008c/.rvm/gems/ruby-2.2.1/gems/byebug-5.0.0 for inspection.
Results logged to /Users/rrobin008c/.rvm/gems/ruby-2.2.1/extensions/x86_64-darwin-14/2.2.0-static/byebug-5.0.0/gem_make.out
An error occurred while installing byebug (5.0.0), and Bundler cannot continue.
Make sure that `gem install byebug -v '5.0.0'` succeeds before bundling.

The significant part is

make: /usr/bin/gcc-4.2: No such file or directory

After this I asked:

$which gcc
/usr/bin/gcc

Follow "OS X Mountain Lion: gcc-4.2 No such file or directory" and everything should work after that.

Upvotes: 0

Gearnode
Gearnode

Reputation: 693

Before you run bundle install, run:

bundle config build.nokogiri --use-system-libraries

or

gem install nokogiri -- --use-system-libraries

After that you can run:

bundle install

For other bugs read the Nokogiri install documentation.

Upvotes: 0

ChrisBarthol
ChrisBarthol

Reputation: 4959

Manually install nokogiri

gem install nokogiri -v VERSION_YOU_WANT -- --use-system-libraries

Check out "nokogiri gem installation error".

Upvotes: 1

Related Questions