pod安装失败,Operation not permitted - /usr/bin/pod

博主在升级MacOSX EL Capitan后遇到CocoaPods命令消失的问题,提供了两种解决方法:一是修改GEM安装路径至自定义目录并更新PATH环境变量;二是使用gem命令参数直接指定安装路径。推荐使用第一种方案。

个人博客地址:http://www.pluto-y.com

博主在升级秤Mac OS X EL Capitan后,发现尼玛,好多命令不见了。然后我的内心几乎是崩溃的,天哪撸!苹果,你怎么能这样对待我,我好不容易安装好的命令你竟然这样把我抛弃。然后最先发现的应该就是我的pod兄弟,麻痹,竟然不见了。

然后我就下意识的就开始安装,并在terminal中输入了sudo gem install cocoapods,结果竟然出现了:
Gem install failed

然后就出现了这样:掀桌子,扶好扶好,不要激动,要淡定。
然后我就找啊找啊找朋友,找到一个好朋友。终于给我找到了解决方案,这里提供两种方案给大家借鉴:

方案一:

$ mkdir -p $HOME/Software/ruby
$ export GEM_HOME=$HOME/Software/ruby
$ gem install cocoapods
[...]
1 gem installed cocoapods
$ export PATH=$PATH:$HOME/Sofware/ruby/bin

方案一中主要是将GEM的安装路径进行修改,将GEM的默认安装路径修改成了$HOME/Software/ruby这个目录,然后再进行安装,最后将安装路径添加到PATH下,这样可以不用带完整的路径进行运行命令。

方案二:

$ gem install cocoapods -n ~/Software/ruby

方案二中使用了gem的自带参数-n—–即指明安装的路径,如果要使用这种的话,也需要将该路径加入PATH下才可以不用带完整的路径进行运行命令。

个人建议是使用第一种,将GEM的安装路径进行修改。这样不需要每次都用-n命令进行指定路径。
最后只想说一句,兵来将挡水来土掩,小样,看你还有什么招。
嘚瑟

转载于:https://my.oschina.net/youtk21ai/blog/540709

[root@yfw ~]# cd /opt/openfire [root@yfw openfire]# cd /tmp [root@yfw tmp]# [root@yfw tmp]# # 创建临时目录用于解压 [root@yfw tmp]# mkdir rpm-extract [root@yfw tmp]# cd rpm-extract [root@yfw rpm-extract]# [root@yfw rpm-extract]# # 使用 rpm2cpio 提取 RPM 中的所有文件 [root@yfw rpm-extract]# rpm2cpio ../javapackages-tools-*.rpm | cpio -idmv ./etc/java/eclipse.conf ./etc/java/font.properties ./etc/java/java.conf ./usr/bin/build-classpath ./usr/bin/build-classpath-directory ./usr/bin/build-jar-repository ./usr/bin/check-binary-files ./usr/bin/clean-binary-files ./usr/bin/create-jar-links ./usr/bin/diff-jars ./usr/bin/find-jar ./usr/bin/rebuild-jar-repository ./usr/bin/shade-jar ./usr/lib/rpm ./usr/lib/rpm/macros.d/macros.jpackage ./usr/share/java-utils ./usr/share/java-utils/java-functions ./usr/share/java-utils/java-wrapper ./usr/share/java-utils/scl-enable ./usr/share/maven-metadata/javapackages-metadata.xml ./usr/share/xmvn ./usr/share/xmvn/configuration.xml 132 blocks [root@yfw rpm-extract]# # 确保目标目录存在 [root@yfw rpm-extract]# mkdir -p /usr/bin [root@yfw rpm-extract]# mkdir -p /etc/java [root@yfw rpm-extract]# mkdir -p /usr/share/java-utils [root@yfw rpm-extract]# [root@yfw rpm-extract]# # 复制 bin 目录下的所有可执行脚本 [root@yfw rpm-extract]# cp ./usr/bin/* /usr/bin/ cp: cannot create regular file '/usr/bin/build-classpath': Operation not permitted cp: cannot create regular file '/usr/bin/build-classpath-directory': Operation not permitted cp: cannot create regular file '/usr/bin/build-jar-repository': Operation not permitted cp: cannot create regular file '/usr/bin/check-binary-files': Operation not permitted cp: cannot create regular file '/usr/bin/clean-binary-files': Operation not permitted cp: cannot create regular file '/usr/bin/create-jar-links': Operation not permitted cp: cannot create regular file '/usr/bin/diff-jars': Operation not permitted cp: cannot create regular file '/usr/bin/find-jar': Operation not permitted cp: cannot create regular file '/usr/bin/rebuild-jar-repository': Operation not permitted cp: cannot create regular file '/usr/bin/shade-jar': Operation not permitted [root@yfw rpm-extract]# [root@yfw rpm-extract]# # 复制配置文件 [root@yfw rpm-extract]# cp ./etc/java/*.conf /etc/java/ cp: overwrite '/etc/java/eclipse.conf'? yes cp: overwrite '/etc/java/java.conf'? yes [root@yfw rpm-extract]# chmod +x /usr/bin/build-classpath \ > /usr/bin/build-jar-repository \ > /usr/bin/find-jar \ > /usr/share/java-utils/java-functions chmod: cannot access '/usr/bin/build-classpath': No such file or directory chmod: cannot access '/usr/bin/build-jar-repository': No such file or directory chmod: cannot access '/usr/bin/find-jar': No such file or directory chmod: cannot access '/usr/share/java-utils/java-functions': No such file or directory [root@yfw rpm-extract]# which build-classpath /usr/bin/which: no build-classpath in (/usr/share/maven/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin) [root@yfw rpm-extract]# build-classpath junit || echo "junit not found (normal if not installed)" -bash: build-classpath: command not found junit not found (normal if not installed) [root@yfw rpm-extract]#
最新发布
10-03
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值