Problem
You don’t want to install rubygems under your home direcotry(~/.gem/ruby/1.x/) when you just forgot to “sudo” and don’t have right permissions to write to system directories.
Solution
First, You need to install rubygems newer than 1.3.2. To check the version, type as
To update your gems itself, type as
Next, you need to edit your ~/.gemrc file. Add
at the bottom of the file.
Now, if you forgot to “sudo” when installing new rubygems, gem will simply fail with permission erros, like
tomoya@hongkong% gem install sequel
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /opt/local/lib/ruby/gems/1.8 directory.