Skip to content

Instantly share code, notes, and snippets.

@Revolucent
Created August 13, 2017 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Revolucent/3f346d2980c76501c5cab112050ef5ba to your computer and use it in GitHub Desktop.
Save Revolucent/3f346d2980c76501c5cab112050ef5ba to your computer and use it in GitHub Desktop.
Launch project in current directory with selected Xcode
#!/bin/bash
XCODE='Xcode';
XCODEPATH="$(xcode-select -p)";
if [[ $XCODEPATH =~ /([^/]+)\.app ]]; then
XCODE="${BASH_REMATCH[1]}"
fi;
open -a "$XCODE" "${1:-.}";
@Revolucent
Copy link
Author

Installation

  1. Download this file to a directory on your path. I recommend ~/bin or /usr/local/bin.
  2. Call it xcode.
  3. chmod +x xcode Make it executable.

Usage

  1. Navigate to a folder containing an Xcode project or workspace.
  2. Type xcode and it will open in Xcode
  3. Use xcode-select -s to activate another Xcode, such as the current beta.
  4. Type xcode and the project will be opened in the selected Xcode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment