gem安装权限问题 [英] gem install permission problem

查看:17
本文介绍了gem安装权限问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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.

当前登录用户是qichunren,qichunre用户对.gem dir有写权限.我想知道gem为什么不先将文件安装到我家的.gem dir中?为什么我的 gem common 首先要安装文件到/opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8

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

推荐答案

对于系统范围的 Ruby 安装,请成为 root.例如:

For a systemwide Ruby install, become root. For example:

$ sudo gem install hpricot

但是,在许多情况下(包括在开发中),现代方法是使用一种工具,让您可以像普通用户一样轻松安装和使用 Ruby.这可以让您避免成为 root.有一些这样的工具,我使用的是 RVM.

However, the modern approach in many circumstances, including in development, is to use a tool that lets you easily install and use Ruby as a normal user. This lets you avoid having to become root. There are a few such tools, and the one I use is RVM.

# install rvm into your ~
$ curl -sSL https://get.rvm.io | bash -s stable

# install latest version of ruby into your ~
$ rvm install ruby

# installs a gem into your ~
$ gem install $SOME_GEM_NAME

这篇关于gem安装权限问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆