This afternoon, while I try to run
cordova run ios
terminal shows up with bunch of identical ambiguous errors. Some of them are as follows
rm: could not remove file (code EACCES)
Error: EACCES, permission denied
Fixing permission:
It is obvious that there is some thing wrong with the permissions. So I decided to put sudo before the command
sudo cordova run ios
Ok fair enough, the error is changed. Now it says
Command failed with exit code 2
You may not have the required environment or OS to run this project
Before going further to solve the issue, lets just make sure that we give full permission on folder to the current user. To know about your actual user name (just to be on safe side) on mac write
echo $(logname)
Since you know your username now, lets give your user full permission on this folder. To do so, write
sudo chown -Rv {angrycoder} ~/Documents/Development/phonegap/appname/
where {angrycoder} should replace by your username followed by the full path of your directory. Unfortunately, that didn't help either and it keep showing the same error.
Actual Issue (XCode License Agreement):
Even after the permission fixed the problem still exists. I decided to look at some other clue in terminal and finds out following
simctl was not found
It seems that simulation control is not installed. This is insane, I was using the same machine to build all these projects. When I open Xcode to make sure if every thing is working fine it throws An Accept License Agreement Screen before welcome dialog appears. Yes, you read it right ... Accept license was the main culprit.
So if you encounter similar issue. Make sure to open your XCode and check if Apple wants you to click somewhere.