Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions script/macos/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,28 @@ set -e

. "$PWD/script/warp_sudo"

if ! [ -d "/Applications/Xcode.app" ]; then
echo "Please install Xcode from the App Store before continuing."
exit 1
DEVELOPER_DIR="$(xcode-select -p 2>/dev/null || true)"
if [ -z "$DEVELOPER_DIR" ] || [ ! -x "$DEVELOPER_DIR/usr/bin/xcodebuild" ] || [ "$DEVELOPER_DIR" = "/Library/Developer/CommandLineTools" ]; then
Comment thread
SagarSDagdu marked this conversation as resolved.
XCODE_APP=""
# Prefer the stable /Applications/Xcode.app when present so users with
# both stable and beta/versioned installs aren't switched away from it.
if [ -x "/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild" ]; then
XCODE_APP="/Applications/Xcode.app"
else
for candidate in /Applications/Xcode*.app; do
if [ -x "$candidate/Contents/Developer/usr/bin/xcodebuild" ]; then
XCODE_APP="$candidate"
break
fi
done
fi
if [ -z "$XCODE_APP" ]; then
echo "Please install Xcode before continuing."
exit 1
fi
Comment thread
captainsafia marked this conversation as resolved.
echo "Selected Xcode at $XCODE_APP"
warp_sudo xcode-select --switch "$XCODE_APP/Contents/Developer"
fi

warp_sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
# Mimic actually launching XCode, which performs some necessary set-up of the
# development environment.
xcodebuild -runFirstLaunch
Expand Down
Loading