Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

ruby on rails - gem install permission problem

qichunren@zhaobak:~> gem install hpricot
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8 directory.

Current login user is qichunren, and qichunre user have write permission with .gem dir.I would like to know why gem not install files into my home .gem dir first? Why my gem common first want to install files into /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try setting GEM_HOME and GEM_PATH to ~/.gem,

For the current terminal session, just type:

export GEM_HOME=~/.gem
export GEM_PATH=~/.gem

If you want these to be set whenever you open a terminal, add the above commands to your ~/.bashrc file.

For a more comprehensive solution to setting up a custom ruby environment, see this tutorial from Site5KB, which describes using a .gemrc file.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...