Save location for different ways to install gems?
Are there any differences in the sav开发者_运维问答e 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?
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.
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.
精彩评论