Skip to content

Instantly share code, notes, and snippets.

@audunolsen
Last active December 31, 2017 17:02
Show Gist options
  • Save audunolsen/dbc3c22d89b57e74dbd0ea76e16a7301 to your computer and use it in GitHub Desktop.
Save audunolsen/dbc3c22d89b57e74dbd0ea76e16a7301 to your computer and use it in GitHub Desktop.
Shell script to open Xcode projects from the command line, call with $ xcode
####################
# Xcode #
####################
# Function to open Xcode projects from the command line, call with $ xcode (BASH version)
# Bash friendly version
function xcode {
proj=$( ls -d *.xcodeproj/ 2>/dev/null )
if [ -n "$proj" ]; then
# Omit -beta if you're not using beta version
open -a Xcode-beta "$proj"
else
echo "No Xcode project detected."
fi
}
####################
# Xcode #
####################
# Function to open Xcode projects from the command line, call with $ xcode (ZSH version)
function xcode {
proj=$( ls -d *.xcodeproj/(N) )
if [ $proj != "." ]; then
# Omit -beta if you're not using beta version
open -a Xcode-beta "$proj"
else
echo "No Xcode project detected."
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment