Understanding the Unix file system and ruby installs without Sudo
I'm trying to comprehend the Unix file system on m开发者_C百科y OSX. I'm following wikipedia Filesystem Hierarchy Standard.
I understand when I install ruby gems I must use the command sudo gem install
but if I omit sudo, problems may occur.
- Where are gems installed within the file system when I omit sudo?
- How can I delete these gems?
- A Fun side question: When I enter
cd ~/.gem
my terminal is directed to.gem user$
, When I enter cd ~/ and list folders using the ls command I can't find a .gem folder. Where is the .gem folder? How does this fit into the Filesystem?
Ok, looking over the Ruby Gems documentation http://docs.rubygems.org/read/chapter/3
the default install directory is:
/usr/local/lib/ruby
Ruby gems uses the environment variable GEM_HOME
for the install path. You can change this via the export command like so:
$ export GEM_HOME=/home/mygemrepository $ ruby setup.rb —prefix=/home/mystuff
You can uninstall gems with the gem uninstall command:
gem uninstall gemtouninstall
Finally, as I already mentioned files/folders starting with .
(such as .bashrc
) are hidden from ls
by default, so use the ls -a
option to see them. You can read more here: http://unixhelp.ed.ac.uk/CGI/man-cgi?ls
Also, sudo
is basically saying, "Do this action as if I was the root user," where the root user is essentially like the highest level administrator. It's a common thing to do when installing software via the command line.
精彩评论