Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rvmsudo vs sudo?

I just moved to RVM.

sudo bundle install gives me and error:-

 sudo bundle install /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:900:in `report_activate_error': Could not find RubyGem bundler (>= 0) (Gem::LoadError) from /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:248:in `activate' from /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:1276:in `gem' from /usr/local/rvm/gems/ruby-1.9.2-p180/bin/bundle:18:in `<main>' 

and

rvmsudo bundle install  

works like a charm. Whats the difference. Whats going on behind the screen. Can anybody explain..

like image 279
Mohit Jain Avatar asked Apr 28 '11 11:04

Mohit Jain


1 Answers

sudo starts a new subshell that does not contain environment variables.
rvmsudo passes on any environment variables that RVM set up to get you to the correct Ruby. This includes the $PATH as well has $GEM_HOME, $GEM_PATH and $BUNDLE_PATH variables.

https://rvm.io/integration/sudo

like image 190
NARKOZ Avatar answered Sep 22 '22 13:09

NARKOZ