Cocoapods Permission Error

Received the following error while trying to run pod install.

errno::EACCES – Permission denied @ dir_s_mkdir – /Users/<username>/.cocoapods/repos/trunk/Specs/9/3

So I had to run the command as sudo – sudo pod install. This successfully installed the pods for the project. But when trying to open the Xcode workspace, again received permission denied error for the Xcode workspace. Then following the below mentioned steps resolved the issue and I was able to open the Xcode project

  1. sudo chmod 777 <project workspace> file
  2. sudo chmod 777 <prokect.xcodeproj> file
  3. sudo chmod 777 Pods