3

No matter what I do, flutter doctor always returns:

[!] Xcode - develop for iOS and macOS (Xcode 13.3)
• Xcode at /Volumes/ssd/Applications/Xcode.app/Contents/Developer
✗ CocoaPods not installed.
    CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
    Without CocoaPods, plugins will not work on iOS or macOS.
    For more info, see https://flutter.dev/platform-plugins
  To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.

when I run

$ gem install cocoapods

I get: ERROR: While executing gem ... (Errno::EACCES) Permission denied @ dir_s_mkdir - /Users/omkar/.local/share/gem/specs

I tried using

$ sudo chown -R /Users/omkar/.local/share/gem/*

Password:

But I got: usage: chown [-fhnvx] [-R [-H | -L | -P]] owner[:group] file ... chown [-fhnvx] [-R [-H | -L | -P]] :group file ...

and the issue of no permission still persists.

How can I give the required permission?

More info: I have followed this answer to install brew and following is the output:

$ which ruby 

/usr/local/opt/ruby/bin/ruby

$ ruby -v 

ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-darwin21]

Omkar Bojjawar
  • 101
  • 1
  • 5

2 Answers2

0

Did you try using

$ sudo gem install cocoapods
Alexis Mejía
  • 59
  • 2
  • 6
  • even after that when I run flutter doctor I get following error: [!] Xcode - develop for iOS and macOS (Xcode 13.3) • Xcode at /Volumes/ssd/Applications/Xcode.app/Contents/Developer ✗ CocoaPods not installed. CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side. Without CocoaPods, plugins will not work on iOS or macOS. For more info, see https://flutter.dev/platform-plugins To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions. – Omkar Bojjawar Mar 23 '22 at 17:19
0

for anyone still having this problem, this solved my problem: https://mac.install.guide/ruby/13.html

TLDR;

  1. brew install ruby

  2. if using zsh, then open -e ~/.zshrc, if using bash, then open -e ~/.bashrc

  3. add these lines to the end: for Apple Intel:

if [ -d "/usr/local/opt/ruby/bin" ]; then
  export PATH=/usr/local/opt/ruby/bin:$PATH
  export PATH=`gem environment gemdir`/bin:$PATH
fi

for Apple Silicon:

if [ -d "/opt/homebrew/opt/ruby/bin" ]; then
  export PATH=/opt/homebrew/opt/ruby/bin:$PATH
  export PATH=`gem environment gemdir`/bin:$PATH
fi

now reopen the terminal and type pod and it should work as expected.

Adnan
  • 906
  • 13
  • 30