Skip to content

Instantly share code, notes, and snippets.

@zaypen
Last active December 14, 2016 13:48
Show Gist options
  • Save zaypen/e50f0af74365f0818e7723874ec81b8c to your computer and use it in GitHub Desktop.
Save zaypen/e50f0af74365f0818e7723874ec81b8c to your computer and use it in GitHub Desktop.
Terminal shortcut with arguments supported for IntelliJ IDEA on macOS
#!/usr/bin/env bash
# Terminal shortcut with arguments supported for IntelliJ IDEA on macOS,
# put this file into `/usr/bin` or `/usr/local/bin` or anywhere in PATH,
# and use `chmod` to make it executable,
# then you could use `idea` in terminal to run IDEA.
IDEA_APP="IntelliJ IDEA.app"
if [ -x "/Applications/$IDEA_APP" ]; then
IDEA_PATH="/Applications"
elif [ -x "$HOME/Applications/$IDEA_APP" ]; then
IDEA_PATH="$HOME/Applications"
else
echo "Cannot locate $IDEA_APP, it is usually located in /Applications."
exit 1
fi
open -a "$IDEA_PATH/$IDEA_APP" "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment