0

Runnin 10.04 64bit Ubuntu. I have a deploy user, and have no problems with "bundle install" but had to update gems and tried this:

deploy@pluto:/opt/ruby/bin$ gem update --system

error:

Updating rubygems-update
Fetching: rubygems-update-1.8.10.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /opt/ruby/lib/ruby/gems/1.8 directory.

Tried with sudo:

deploy@pluto:/opt/ruby/bin$ sudo gem update --system
[sudo] password for deploy: 
sudo: gem: command not found

Then logged in as root, and no problem!?

root@pluto:/opt/ruby/bin# gem update --system
Updating rubygems-update
Fetching: rubygems-update-1.8.10.gem (100%)
Successfully installed rubygems-update-1.8.10
Installing RubyGems 1.8.10
RubyGems 1.8.10 installed

This is my $PATH variable with and without sudo, any ideas what's wrong?

deploy@pluto:~$ echo 'echo $PATH' | sudo sh
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin

deploy@pluto:~$ echo $PATH
/opt/ruby/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
fatfrog
  • 2,118
  • 1
  • 23
  • 46

1 Answers1

0

You should not need sudo to install gems. Looks like when you first installed Ruby/Rails, you used sudo. This installs ruby/rails in folders that are siblings to the home folder. There are multiple resources that tell you how to set up Ruby/Rails on a Ubuntu box only resource that worked for me (i followed these instructions to install Rails on 4 Ubuntu boxes) was Toran Billups article here. Read it carefully and you should have a good environment set up.

mithun_daa
  • 4,334
  • 5
  • 38
  • 50