Reputation: 16011
Are there any differences in the save locations for the following commands?:
gem install some_gem
sudo gem install some_gem
bundle install
bundle install
is for rails 3 project.
Will all of them save the installed gem in the same directory or in different directories?
Upvotes: 1
Views: 300
Reputation: 25377
The Tin Man answered sudo
vs. non-sudo
, so as for bundler...
Bundler installs gems to the system path (similarly to if they'd been installed by sudo
)--at least on OSX, though I imagine other OS would be the same.
Upvotes: 1
Reputation: 160551
Probably in different directories, because the "root" user has a different account and path than you do.
Root's access via sudo
will allow the file to be written to the gem environment for a Ruby in the /usr/bin
or /usr/local/bin
directories. (Gem won't put the files there, but they'll be associated with a Ruby in one of those directories.)
You don't have access to write to those areas by default, so if you tried to run gem install
, and only had a System Ruby, you'd probably get permission errors and the attempt should fail.
Upvotes: 2