Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save DeveloperBeau/67c4dd817de688838afa5a55bc7e421a to your computer and use it in GitHub Desktop.

Select an option

Save DeveloperBeau/67c4dd817de688838afa5a55bc7e421a to your computer and use it in GitHub Desktop.
# Function to open Xcode projects from the command line, call with 'xcode'
#note - this will not work as expected if you have multiple xcode projects/workspaces in the same folder.
xcode () {
workspace=$(ls -d *.xcworkspace/ 2>/dev/null)
proj=$(ls -d *.xcodeproj/ 2>/dev/null)
if [ -n "$workspace" ]; then
echo "found xcworkspace, opening now..."
open -a Xcode "$workspace"
return
elif [ -n "$proj" ]; then
echo "found xcproject, opening now..."
open -a Xcode "$proj"
return
else
echo "failed to open project - project not found"
return
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment