I am trying to install cocoapods in my Apple M2 MacBookPro by using this command:
sudo gem install cocoapods
Then I get the below errors:
Fetching rexml-3.2.5.gem
Fetching nanaimo-0.3.0.gem
Fetching colored2-3.1.2.gem
Fetching claide-1.1.0.gem
Fetching atomos-0.1.3.gem
Fetching ruby-macho-2.5.1.gem
Fetching xcodeproj-1.22.0.gem
Fetching nap-1.1.0.gem
Fetching molinillo-0.8.0.gem
Fetching gh_inspector-1.1.3.gem
Fetching fourflusher-2.3.1.gem
Fetching escape-0.0.4.gem
Fetching cocoapods-try-1.2.0.gem
Fetching netrc-0.11.0.gem
Fetching cocoapods-trunk-1.6.0.gem
Fetching cocoapods-search-1.0.1.gem
Fetching cocoapods-plugins-1.0.0.gem
Fetching cocoapods-downloader-1.6.3.gem
Fetching cocoapods-deintegrate-1.0.5.gem
Fetching ffi-1.15.5.gem
Fetching ethon-0.16.0.gem
Fetching typhoeus-1.4.0.gem
Fetching public_suffix-4.0.7.gem
Fetching fuzzy_match-2.0.4.gem
Fetching concurrent-ruby-1.1.10.gem
Fetching json-2.6.3.gem
Fetching httpclient-2.8.3.gem
Fetching algoliasearch-1.27.5.gem
Fetching addressable-2.8.1.gem
Fetching zeitwerk-2.6.6.gem
Fetching tzinfo-2.0.5.gem
Fetching minitest-5.17.0.gem
Fetching cocoapods-1.11.3.gem
Fetching i18n-1.12.0.gem
Fetching activesupport-6.1.7.gem
Fetching cocoapods-core-1.11.3.gem
**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.**
enter code here
/Library/Ruby/Site/2.6.0/rubygems/installer.rb:712:in `verify_gem_home'
/Library/Ruby/Site/2.6.0/rubygems/installer.rb:902:in `pre_install_checks'
/Library/Ruby/Site/2.6.0/rubygems/installer.rb:302:in `install'
/Library/Ruby/Site/2.6.0/rubygems/resolver/specification.rb:104:in `install'
/Library/Ruby/Site/2.6.0/rubygems/request_set.rb:194:in `block in install'
/Library/Ruby/Site/2.6.0/rubygems/request_set.rb:182:in `each'
/Library/Ruby/Site/2.6.0/rubygems/request_set.rb:182:in `install'
/Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:214:in `install_gem'
/Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:230:in `block in install_gems'
/Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:223:in `each'
/Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:223:in `install_gems'
/Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:169:in `execute'
/Library/Ruby/Site/2.6.0/rubygems/command.rb:323:in `invoke_with_build_args'
/Library/Ruby/Site/2.6.0/rubygems/command_manager.rb:251:in `invoke_command'
/Library/Ruby/Site/2.6.0/rubygems/command_manager.rb:191:in `process_args'
/Library/Ruby/Site/2.6.0/rubygems/command_manager.rb:149:in `run'
/Library/Ruby/Site/2.6.0/rubygems/gem_runner.rb:51:in `run'
/usr/bin/gem:21:in `<main>'
Then I tried this one:
MacBook-Pro ~ % sudo gem uninstall ffi && sudo gem install ffi -- --enable-libffi-alloc
Gem 'ffi' is not installed
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.**
/Library/Ruby/Site/2.6.0/rubygems/installer.rb:712:in `verify_gem_home'
/Library/Ruby/Site/2.6.0/rubygems/installer.rb:902:in `pre_install_checks'
/Library/Ruby/Site/2.6.0/rubygems/installer.rb:302:in `install'
/Library/Ruby/Site/2.6.0/rubygems/resolver/specification.rb:104:in `install'
/Library/Ruby/Site/2.6.0/rubygems/request_set.rb:194:in `block in install'
/Library/Ruby/Site/2.6.0/rubygems/request_set.rb:182:in `each'
/Library/Ruby/Site/2.6.0/rubygems/request_set.rb:182:in `install'
/Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:214:in `install_gem'
/Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:230:in `block in install_gems'
/Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:223:in `each'
/Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:223:in `install_gems'
/Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:169:in `execute'
/Library/Ruby/Site/2.6.0/rubygems/command.rb:323:in `invoke_with_build_args'
/Library/Ruby/Site/2.6.0/rubygems/command_manager.rb:251:in `invoke_command'
/Library/Ruby/Site/2.6.0/rubygems/command_manager.rb:191:in `process_args'
/Library/Ruby/Site/2.6.0/rubygems/command_manager.rb:149:in `run'
/Library/Ruby/Site/2.6.0/rubygems/gem_runner.rb:51:in `run'
/usr/bin/gem:21:in `<main>'
System Info:
- MacBook Pro M2
- macOS Ventura 13.1, Xcode 14.2
- Xcode command line tools 14.2
even simpler: