Skip to content

Instantly share code, notes, and snippets.

@feosuna1
Created November 7, 2022 15:39
Show Gist options
  • Select an option

  • Save feosuna1/396c41d3da60081ee7b207c01e4d16c5 to your computer and use it in GitHub Desktop.

Select an option

Save feosuna1/396c41d3da60081ee7b207c01e4d16c5 to your computer and use it in GitHub Desktop.
Command line script for opening Xcode in the current working directory
#!/usr/bin/env sh
XCODE_APP=$(xcode-select -p)
XCODE_APP="${XCODE_APP%%.app*}.app"
if [[ -z "${XCODE_APP// }" ]]; then
echo "Unable to find path for Xcode installation. Install Xcode."
exit 1
fi
echo "Opening Xcode..."
open -a "${XCODE_APP}" "${@:-.}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment