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

ruby – 安装cocoapod时获得“没有写权限”

发布时间:2020-12-17 03:43:01 所属栏目:百科 来源:网络整理
导读:我正在尝试为我的ios应用程序设置谷歌登录,为此我需要 CocoaPods.但是当它像终端上的自己的网站一样安装时,我得到了这个: $sudo gem install cocoapods[Password: (*Put in my admin password for my macbook*)ERROR: While executing gem ... (Gem::FilePe
我正在尝试为我的ios应用程序设置谷歌登录,为此我需要 CocoaPods.但是当它像终端上的自己的网站一样安装时,我得到了这个:

$sudo gem install cocoapods

[Password: (*Put in my admin password for my macbook*)
ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.

这是在运行High Sierra 10.13.2的Macbook Air上完成的
(不知道你是否需要这些信息,但我以前从未做过任何关于cocoapods或ruby的事情)

我也试过跟随这个link并跟随awnser并安装了RVM,或者至少我认为我做了.我把它放进去:

ruby -e "$(curl -fsSL 
https://raw.githubusercontent.com/Homebrew/install/master/install)"

那之后我尝试安装CocoaPods但仍然有同样的事情.

解决方法

您可以尝试以下命令

sudo gem install cocoapods -n /usr/local/bin

问题是gem安装尝试使用/usr/bin来安装二进制文件,不应该为System Integrity Protection触及.因为:

A centerpiece is the protection of system-owned files and directories
against modifications by processes without a specific “entitlement”,
even when executed by the root user or a user with root privileges
(sudo)

在这种情况下,苏多没有任何力量.

因此解决方案使用-n,从gem帮助安装它说:

-n,–bindir DIR Directory where binary files are located

通过这种方式,您可以将二进制文件移动到更舒适的目的地:/usr/local/bin,代表普通用户可以运行的程序.

(编辑:李大同)

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

    推荐文章
      热点阅读