0

I am using Ubuntu 14.04. I wanted to use the latest ruby (version 2.1.3), so I installed it with RVM.

rvm install ruby --latest
rvm use ruby --latest --default

But when I try to install Rails, i get the following error:

vagrant@vagrant-ubuntu-trusty-64:~$ sudo gem install rails
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.8.1 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator/gem_make.out

What is wrong?

2 Answers2

0

IIRC, mkmf is in the ruby-dev package:

rvm install 1.9.1-dev

Install manually with sudo apt-get install ruby1.9.1-dev (depending on your version).

Jan
  • 12,291
  • 3
  • 32
  • 38
-1

I followed the steps no this blog. It was helpful. http://ryanbigg.com/2014/10/ubuntu-ruby-ruby-install-chruby-and-you/

Lastly, you'll want to free up space by telling Rubygems not to install the documentation for each package locally, run: echo "gem: --no-ri --no-rdoc" > ~/.gemrc

  • Welcome to askubuntu. While it is always good to cite one's sources at least the important parts to answer a question should be posted here. There is no guarantee that the linked website will remain as it is and thus be useful in the future. – Adaephon Oct 16 '14 at 11:10