Running rbenv with sudo #60

marcelokanzaki opened this Issue Aug 24, 2011 · 8 comments


None yet

9 participants


gem install rails
=> dont have permissions to write in the gems directory

sudo gem install rails
=> unknow gem command


graywh commented Aug 24, 2011

sudo doesn't inherit your $PATH

Instead, you can sudo $(rbenv which gem) command.


Don't use rbenv with sudo.

@sstephenson sstephenson closed this Sep 9, 2011

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.

grosser commented Oct 18, 2011
function rbenvsudo(){
  shift 1
  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?

hgupta commented Dec 23, 2013

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.

mislav commented Dec 23, 2013

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment