Mac上的Ruby未安装显示权限被拒绝的gem [英] Ruby on mac not installing gem showing permission denied
问题描述
我正在尝试使用xcode在我的机器"中安装红宝石gem,我将其称为shell脚本.
I am trying to install a ruby gem in My Machine using xcode where I call a shell script.
cd"/Users/Desktop/gemfolder"
cd "/Users/Desktop/gemfolder"
gem安装somegem.gem
gem install somegem.gem
我遇到这样的错误:
While executing gem ... (Errno::EACCES)
Permission denied - /Library/Ruby/Gems/1.8
任何解决方法,我是红宝石的新手,所以不知道该怎么做,将不胜感激.
Any workaround for it I am a newbie to ruby so don't know what to do anyhelp will highly appreciated.
推荐答案
使用sudo
可能会解决您的问题,但是,当您安装gems时,将它们安装为sudo
并不是一个好主意,因此首选方式在任何计算机上安装ruby的方法是先安装 rvm(Ruby版本管理器),然后再安装您的ruby版本.
Being sudo
might fix your problem, however when you are installing gems , its not a good idea to install them as sudo
, so the preferred way of installing ruby on any machine is to install rvm (Ruby Version Manager) first and then install your ruby version.
拥有ruby版本管理器的主要优点是
Main advantages of having a ruby version manager are,
1-允许您并排安装多个红宝石版本
1 - allows you to install multiple ruby versions side by side
2-允许您为每个红宝石版本安装宝石(通过宝石集)
2 - allows you to install gems for each ruby version (via gemsets)
要在Mac中安装rvm,请在此处检查
So to install rvm in your mac, check here
这篇关于Mac上的Ruby未安装显示权限被拒绝的gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!