当前位置: 首页 > 工具软件 > Gem Framework > 使用案例 >

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

法风畔
2023-12-01

一、错误

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

 类似资料: