加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby – 使用sudo进行gem安装cocoapods

发布时间:2020-12-16 21:45:00 所属栏目:百科 来源:网络整理
导读:当我跑 $gem install cocoapods 我得到 Fetching: i18n-0.7.0.gem (100%)ERROR: While executing gem ... (Gem::FilePermissionError)You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory. 我读过这篇文章cocoaPods pod install P
当我跑
$gem install cocoapods

我得到

Fetching: i18n-0.7.0.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

我读过这篇文章cocoaPods pod install Permission denied
但是答案并没有说明你的宝石安装运行sudo是否正确(尽管问题中被问及 – 可否安装可可可可的方式是正确的还是正常的?).

解决方法

看来你没有使用任何包管理器.既然,你没有这个目录的写入权限,那么使用sudo来安装gem就没有什么问题.

但是,我更喜欢更改该目录的所有权,所以我不必每次都使用sudo.
即sudo chown -R [登录名] /Library/Ruby/Gems/2.0.0

并确保我有写许可. sudo chmod -R u w /Library/Ruby/Gems/2.0.0

考虑使用rvm(ruby版本管理器)或rbenv

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读