The current implementation isn't very resilient when it comes to the output of xcrun. Currently it cannot deal with:
- Trailing newlines.
- Leading newlines and errors/warnings before the Xcode path.
- Xcode not being named Xcode.app.
This extract the logic into a helper in PlatformMacOSX and fixes those issues.
Technically, I suppose BridgeOS belongs in here, too.