sger
sger

Reputation: 740

sudo gem install rails error under ubuntu 13.04

I'm trying to set up rails with

sudo gem install rails

i'm using rvm

Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from extconf.rb:1:in `<main>'


Gem files will remain installed in /var/lib/gems/1.9.1/gems/json-1.7.7 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.7.7/ext/json/ext/generator/gem_make.out

i'm getting many errors currently using ruby 2.0

any help how to solve this error.

Upvotes: 2

Views: 2591

Answers (3)

Michael Grant
Michael Grant

Reputation: 350

Some extra detail. I had to do things in this order:

sudo apt-get build-dep ruby rubygems rails

then I had to install rdoc

sudo gem install rdoc

because if you don't install rdoc first (at the time of this writing), you get this error:

file 'lib' not found

Then, finally, you can install Rails:

sudo gem install rails

and it takes a LONG time, so be patient.

Upvotes: 1

jgomo3
jgomo3

Reputation: 1223

I had the same problem, so i did previously an installation of build dependencies for ruby, rubygems and rails:

sudo apt-get build-dep ruby rubygems rails

.. and then issue the sudo gem install rails, and it worked.

Upvotes: 5

Grey
Grey

Reputation: 676

Use this command

$ \curl -L https://get.rvm.io | bash -s stable --autolibs=3 --rails

after this check if any requirements left by

rvm requirements

Upvotes: 1

Related Questions