M1 MacBook:ERROR: While executing gem ... (Gem::FilePermissionError)

一、错误

sudo gem install cocoapods 

Password:
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 directory.

二、解决

curl -L https://get.rvm.io | bash -s stable

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   194  100   194    0     0     85      0  0:00:02  0:00:02 --:--:--    85
100 24535  100 24535    0     0   9372      0  0:00:02  0:00:02 --:--:--  164k
curl: (22) The requested URL returned error: 403
WARN: ...the preceeding error with code 22 occurred while fetching https://api.github.com/repos/rvm/rvm/tags
Downloading https://github.com/rvm/rvm/archive/1.29.12.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc
Found PGP signature at: 'https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc',
but no GPG software exists to validate it, skipping.
Upgrading the RVM installation in /Users/liuyongjie/.rvm/
    RVM PATH line found in /Users/liuyongjie/.mkshrc /Users/liuyongjie/.profile /Users/liuyongjie/.bashrc /Users/liuyongjie/.zshrc.
    RVM sourcing line found in /Users/liuyongjie/.profile /Users/liuyongjie/.bash_profile /Users/liuyongjie/.zlogin.
Upgrade of RVM in /Users/liuyongjie/.rvm/ is complete.

Thanks for installing RVM 🙏
Please consider donating to our open collective to help us maintain RVM.

👉  Donate: https://opencollective.com/rvm/donate



rvm install ruby

Searching for binary rubies, this might take some time.
No binary rubies available for: osx/12.2/arm64/ruby-3.0.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Installing requirements for osx.
Updating system - please wait
Installing required packages: autoconf, automake, libtool, pkg-config, coreutils, libksba, zlib - please wait
Updating certificates bundle '/opt/homebrew/etc/openssl@1.1/cert.pem'
Requirements installation successful.
Installing Ruby from source to: /Users/liuyongjie/.rvm/rubies/ruby-3.0.0, this may take a while depending on your cpu(s)...
ruby-3.0.0 - #downloading ruby-3.0.0, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 18.6M  100 18.6M    0     0  2603k      0  0:00:07  0:00:07 --:--:-- 2046k
ruby-3.0.0 - #extracting ruby-3.0.0 to /Users/liuyongjie/.rvm/src/ruby-3.0.0 - please wait
ruby-3.0.0 - #configuring - please wait
ruby-3.0.0 - #post-configuration - please wait
ruby-3.0.0 - #compiling - please wait
ruby-3.0.0 - #installing - please wait
ruby-3.0.0 - #making binaries executable - please wait
Installed rubygems 3.2.3 is newer than 3.0.9 provided with installed ruby, skipping installation, use --force to force installation.
ruby-3.0.0 - #gemset created /Users/liuyongjie/.rvm/gems/ruby-3.0.0@global
ruby-3.0.0 - #importing gemset /Users/liuyongjie/.rvm/gemsets/global.gems - please wait
ruby-3.0.0 - #generating global wrappers - please wait
ruby-3.0.0 - #gemset created /Users/liuyongjie/.rvm/gems/ruby-3.0.0
ruby-3.0.0 - #importing gemsetfile /Users/liuyongjie/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-3.0.0 - #generating default wrappers - please wait
ruby-3.0.0 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-3.0.0 - #complete 
Ruby was built without documentation, to build it run: rvm docs generate-ri

三、指定目录安装(为兼容老版本项目,inter处理器默认安装路径就是这里)

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

Password:
Fetching nanaimo-0.3.0.gem
Fetching colored2-3.1.2.gem
Fetching CFPropertyList-3.0.5.gem
Fetching atomos-0.1.3.gem
Fetching xcodeproj-1.21.0.gem
Fetching claide-1.1.0.gem
Fetching ruby-macho-2.5.1.gem
Fetching nap-1.1.0.gem
Fetching molinillo-0.8.0.gem
Fetching gh_inspector-1.1.3.gem

参考:https://developer.apple.com/forums/thread/697249

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

sailip

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值