Oh my good gravy!
I was working on a cleanly installed Mac after migrating user accounts onto it. My account is not the primary admin account (eg. UID 501). For some reason Xcode was installed with all the permissions set to that primary user, who has yet to log onto this Mac!
I have been having multiple issues trying to get Xcode to build on this Mac — my traveling Mac. I like to leave my bread and butter Mac at home and travel with an 11 inch MacBook Air. Primarily because any other Mac cannot be opened on an airplane, in Economy. I cannot afford to fly business class since the Indie-Apocalypse hit in 2014.
So the owner permissions were all f’ed up, where Xcode does it’s build business. The last straw was the “Command CompileAssetCatalog” failure.
The fix is to change the permissions on the Xcode folder in my own home Library (which all files should be all owed my username.) Pro Tip: replace your username where you see mine — tmitra
Checking the ownership of this folder showed I was not the owner. So I stepped back and fixed the permissions on the Xcode directory here:
sudo chown -R tmitra ~/Library/Developer/Xcode
Build and Run.
FWIW I also had to fix permissions elsewhere:
Error: Failed to create temporary directory: /Library/Developer/Xcode/UserData/IB Support/Simulator Devices/
sudo chown -R tmitra ~/Library/Developer/CoreSimulator/Devices
“tmp” couldn’t be removed because you don’t have permission to access it
sudo chown tmitra /Users/tmitra/Library/Developer/Xcode/DerivedData
Your mileage may vary.