gem install rails
=> dont have permissions to write in the gems directory
sudo gem install rails
=> unknow gem command
sudo doesn't inherit your $PATH
Instead, you can sudo $(rbenv which gem) command.
sudo $(rbenv which gem) command
Don't use rbenv with sudo.
How do i run passenger on port 80 with rbenv ? I need sudo right ?
@letronje Yeah, if you're running anything on a port below 100 you need root privs.
I'd recommend using apache and mod_proxy, but that's just me.
sudo $(rbenv which $executable) $*
Actually I think anything under port 1024 requires root privileges, including 443 for the http protocol. Also, nice function @grosser,very handy when exporting to for example upstart in /etc/init with the foreman gem or binding app servers on < 1024 ports. Would be nice is this function was included in rbenv, like rvm has rvmsudo. Any chance you might incorporate such a function or is that out of scope @sstephenson?
I just stared using Bluepill to manage my delayed_jobs, but it can be loaded only as sudo. Although there is a gem called rbenv-sudo, I was hoping if @sstephenson could permanently add such function as a part of existing repo. If it is out of scope, I would very much like to know why authors think that adding sudo is a bad idea.
@hgupta If the rbenv-sudo plugin solves your problem, I would say use the plugin. We didn't provide functionality to facilitate running rbenv through sude because a lot of people are mistakenly using sudo for scenarios where that is harmful to them in the long run. Most rbenv users shouldn't need sudo, and we don't maintain features that most of our users won't need.