Installing Cocoapods in M1 Mac

Install brew and Cocoapods in M1 Mac

Installing Cocoapods in M1 Mac
Logo of Cocoapods - Red background for cocoa and no background for pods. The stylised COCOAPODS (all caps) text is enclosed in two angle brackets (<>)

Previously Cocoapods in mac was installed using gem

sudo gem install cocoapods

This now throws errors when running pod install. To fix this, uninstall the Cocoapods installed using gem with the following command

sudo gem uninstall cocoapods

Now install cocoapods using home brew with the following command

brew install cocoapods

If you see the error 'command not found' when you run the above command, you can install brew with the following command and follow the on screen instructions to enter the password when required

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

You should now run the following command to add brew to your PATH

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/vignesh/.zprofile

Make sure to change 'vignesh' to your user name

To load the new PATH, run the following command

eval "$(/opt/homebrew/bin/brew shellenv)"

That's it! You should have Cocoapods running on your M1 Mac.