0

First I installed rvm for multi-user using script

 \curl -L https://get.rvm.io | sudo bash -s stable 

and I added users to rvm group.

and rvm seems worked fine. so I installed ruby 1.9.3 and set 1.9.3 as default

and now I tried to install rails with command

 gem install rails 

It seems worked fine, but when fetching json-1.7.6.gem and an error occurs.

 ERROR: Error installing rails: ERROR: Failed to build gem native extension. /usr/local/rvm/rubies/ruby-1.9.3-p374/bin/ruby extconf.rb creating Makefile make sh: make: Permission denied Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p374/gems/json-1.7.6 for inspection. Results logged to /usr/local/rvm/gems/ruby-1.9.3-p374/gems/json-1.7.6/ext/json/ext/generator/gem_make.out 

So I thought it would be related with permission, so I tried

 sudo gem install rails 

but then this error occurs.

 sudo: gem: command not found 

What should I do?

2 Answers 2

1

use sudo as follows..

sudo gem install rails 

Updated Answer:

our $PATH variable needs to include the exact path to your Ruby's bin directory. Adding a directory to the PATH does not include it's subfolders. Try adding the bin directory via:

export PATH=$PATH:/home/adam/.gem/ruby/1.8/bin 

or if you installed the gem using sudo:

export PATH=$PATH:/usr/lib/ruby/gems/1.8/bin 

You might want to add this to your .bashrc file, so that you don't have to set this manually every time your open up a new bash.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! now I can call sudo gem!
0

you can use rvmsudo to run sudo commands. But you should really be using Gemfiles to install gems using Bundler.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.