1

I am ruby1.8 user, as well as gem; it's library manager system.

gem is able to install binaries, like rails and bundle.

But I could not get access for this guys until I added this line to my .bashrc :

export PATH=$PATH:/var/lib/gems/1.8/bin

So now, the binaries work, but not if I use sudo first!

fabianops ~/workspace3/peded $ sudo rails s thin -p80 -blocalhost --debugger
[sudo] password for fabianops: 
sudo: rails: command not found

I need sudo to bind port 80, how can I use sudo rails .. ?

Never had that issue with Ubuntu 10.

update: I guess, what I want is for these PATH to be available system wide.

2 Answers 2

1

By default sudo resets environment to minimal set of variables. See 'SECURITY NOTES' section in man sudo. To preserve you environment variables you could use sudo -E (or see env_reset option in man sudo). Also, to debug, you could try comparing output of sudo env/env and sudo gem env/gem env.

0
  1. sudo su -
  2. rails s thin -p80 -blocalhost --debugger

Determine the actual error. Or explicitly pass the path to rails so the sudo cmd.

2
  • Did that, and got: The program 'rails' is currently not installed. You can install it by typing: ... May 26, 2011 at 19:51
  • Does whereis rails while elevated locate things? How did you install rails? Basically it seems like your path isn't right. Rather than pollute the root account and/or other accounts, it's probably better to use the explicit path to rails when you run sudo. YMMV.
    – OldTroll
    May 26, 2011 at 20:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .