I tried my first shot at Phonegap today. I installed Phonegap command line utilities, using node.js npm modules and stuff.
And then I downloaded the latest Xcode from Apple. And as per instruction in here (in the Install the SDK section), I also installed the Xcode command line tools.
Then I tried:
$ phonegap create hello com.example.helloapp HelloApp
$ cd hello
$ phonegap platform add ios
[Error: Xcode is (probably) not installed, specifically the command `xcodebuild` is unavailable or erroring out. Output of `xcodebuild -version` is: Error: Can't run /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/xcodebuild (no such file).
After much googling, I found this on StackOverflow:
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
And it solved the problem.