Learn Courses My Dashboard

Error: Command PhaseScriptExecution failed with a nonzero exit code

Hi guys,

I started using a new MacBook and I keep getting this error. So far, most people from StackOverflow suggested deleting:

  1. Podfile.lock
  2. Pods folder
  3. .xcworkspace
    and then do pod install. However, whenever I do the sudo gem install cocoapods I get this error on my terminal.

I also tried playing with the keychain access but still no luck.
Any ideas on how I can fix this?
Thanks in advance! :))

First, what is it you’re trying to do??


You may find that it might be as simple as cleaning the build folder - Shift + Command + K
and then do a Build - Command + B

I’m just tryna run my project on a simulator

I did this but neither did it work for me :confused:


Do you have a Mac that is equipped with an M1 chip?

yes I do


Instead of installing cocoapods on your Mac, which needs to be done differently on an M1 chipped machine, it is much easier to add third party frameworks, like Firebase, by using Xcode’s built in Swift Package Manager.

It’s simpler and faster. Here is a link to a video from Chris Ching that explains how to do that.

1 Like

Hi Chris,

So I followed this tutorial step by step. However, after adding the file .plist file and the package, it still gives this error.

Have you deleted Derived Data?
I could do that, clean the project, and then try to build again