Skip to content

Instantly share code, notes, and snippets.

@baileythegreen
Last active August 29, 2022 13:03
Show Gist options
  • Save baileythegreen/91c5ce4cdf7444ef19e561d0581b988c to your computer and use it in GitHub Desktop.
Save baileythegreen/91c5ce4cdf7444ef19e561d0581b988c to your computer and use it in GitHub Desktop.
Create a mac clickable executable (.command) file
#! /bin/bash
cd ~/Desktop
mkdir myCoolFolder
cd myCoolFolder
# Uncomment to launch an application (here, the Atom text editor)
# open -a Atom
exit 0

Create a file like clickable_file.command above using TextEdit, or a different text editor of your choice. It should have the .command extension. Save it on the Desktop (or wherever you want it to be located).

After creating it, you will need to run this command in a Terminal window:

chmod u+x ~/Desktop/command.command  # substitute Desktop with the location you chose, if different

To get the Terminal window this opens to exit cleanly (and close itself), there seem to be a few options. This probably comes down to personal preference/knowledge.

Close Terminal Window automatically

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