xcrun: error: SDK “iphoneos” cannot be located

Make sure that you have Command Line Tools installed with Xcode by running:

xcode-select --install

After that, issue the following to have it available systemwide:

sudo xcode-select --switch /Applications/Xcode.app