更新macOS的版本后,pod install等命令经常就无效了,或者是出现如下这样的反应:
pod install
...
Generating Pods project
Abort trap: 6
也是安装失败了。
只能重新安装一下gem和cocoapods。
打开终端,输入命令行。
先确保gem的资源地址是国内的镜像地址:
$ gem sources -l
*** CURRENT SOURCES ***
https://ruby.taobao.org
用这行命令查看资源后是taobao镜像就ok了,如果不是,则要修改一下:
$ gem sources --remove https://rubygems.org/
$ gem sources -a https://ruby.taobao.org/
$ gem sources -l
*** CURRENT SOURCES ***
https://ruby.taobao.org
先移除原来的地址,然后添加镜像地址。
然后清楚原来安装的gem:
$ sudo gem uninstall cocoapods
$ sudo gem uninstall cocoapods-core
$ sudo gem uninstall cocoapods-deintegrate
$ sudo gem uninstall cocoapods-downloader
$ sudo gem uninstall cocoapods-plugins
$ sudo gem uninstall cocoapods-search
$ sudo gem uninstall cocoapods-stats
$ sudo gem uninstall cocoapods-try
$ sudo gem uninstall cocoapods-trunk
这一步完成后,就可以安装了,直接输入:
$ sudo gem install cocoapods --pre
这是出现了这个错误:
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/xcodeproj
查了资料后使用这种方式来安装:
$ sudo gem install -n /usr/local/bin cocoapods --pre
就安装成功了,这时候再去工程目录下pod install,就可以成功了。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有