Skip to content

Instantly share code, notes, and snippets.

@jonsuh
Last active August 29, 2015 14:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonsuh/40182e455b11e2b7ff7c to your computer and use it in GitHub Desktop.
Save jonsuh/40182e455b11e2b7ff7c to your computer and use it in GitHub Desktop.
~/.bash_profile
# Open applications
alias opentest='open "/Applications/Adium.app" && open "/Applications/Adobe Photoshop CC 2015/Adobe Photoshop CC 2015.app"'
# Close applications
alias closetest='osascript -e "quit app \"Adium\"" && osascript -e "quit app \"Adobe Photoshop CC 2015\""'
@jonsuh
Copy link
Author

jonsuh commented Jun 25, 2015

Open application Terminal command

open "/Application/Full/Path/File.app"

Close application Terminal command

osascript -e "quit app \"Application Name\""

Application Name for the close command is the "visual" name (the name you'd see in the Dock or App Switcher)

For multiple commands at once use && to separate

open "/Application/Full/Path/File.app" && open "/Application/Full/Path/File.app"

To make a command-line shortcut (alias) to run these commands, edit your ~/.bash_profile file (i.e. nano ~/.bash_profile)

If you don't have a .bash_profile file, create one in your ~/ (/Users/username/) directory

cd ~
touch ~/.bash_profile
nano ~/.bash_profile

Declare an alias with a command like such:

alias commandname='the command to run'

Now to put the two together:

alias opentest='open "/Applications/Adium.app" && open "/Applications/Adobe Photoshop CC 2015/Adobe Photoshop CC 2015.app"'

Save the file (CTRL+X). Save changes (Y). When prompted for the File Name, just press Enter

Reload your ~/.bash_profile so Terminal loads in the new aliases by running this command:

source ~/.bash_profile

Type opentest and watch the magic happen

@cdevroe
Copy link

cdevroe commented Jun 25, 2015

😄

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