issue with cocoapods installation

sudo gem install cocoapods

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.

Replies

Me also facing this same issue, but not yet got any solution.

this works for me:

Step 1 (install HomeBrew)

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

  Step 2 (Run these two commands in your terminal to add Homebrew to your PATH)

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/”YOUR USER FORLDER”/.zprofile  

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

  Step 3 (now you can install cocoapods)

brew install cocoapods

  • I did all you said but it says cocoapods is installed but not running

  • step2: echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile

Add a Comment

same problem stuck since hours. Nothing Seems to work. @gormarroquin permission denied while executing your commands as well for brew

Same problem guys, did anyone found any solution to it ?

Add a Comment

Hi Guys, My solution (on Big Sur 11.6.2):

Step 1:

Install brew

1. curl -fsSL -o install.sh https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh
2. /bin/bash install.sh

Step 2:

brew install chruby ruby-install

Step 3:

brew install cocoapods

Step 4: (Check your cocoapods version):

brew upgrade cocoapods

Need Xcode Command Line Tools, if not installed then run this command: sudo xcode-select --install

It's works for me

  • thank you, my problem solved

  • Thanks for solution

  • This works fine for me. Currently running Monterey 12.6.2

I was getting this exact error mentioned.

In my case, the MacOs update for BigSur + Monterey update, solved the problem like a charm.

After Monterey got installed I could pod install normally with no more errors.

What I did was run the following and it seemed to work

gem install cocoapods --user-install

I guess from there you need to update your path to point to the user directory.

  • to do so, run the following with XXXXXXXX replaced with the directory of your installation of cocoapods ending in /bin:

    echo 'export PATH="XXXXXXXXXX$PATH" ' >> ~/.bash_profile

  • In doing it this way you don't need to install unnecessary package installers like HomeBrew 3rd party versions of Ruby. No disrespect meant to others that have offered working solutions, for me I just didn't want to install more things than I needed

Add a Comment

Your solution was life-changing. I can save my tears for another bug! Thank you stranger, I hope you are well-blessed :)