Could someone please tell me how to insert a terminal command into an "application" so when the app is clicked/opened the command is launched?

  • 1
    What is it, explicitly, that you're trying to accomplish? There are several ways to do what you're asking, AppleScript, Automator or third-party Platypus. Feb 21 '16 at 22:51
  • um I'm trying to put an terminal command in an app so when open all the apps will open so my old computer won't work any more. pretty stupid way to crash it, but please don't judge Feb 21 '16 at 23:00
  • What is the actual command you're wanting to execute? Feb 21 '16 at 23:13
  • find /Applications -name *.app -prune -exec open {} \; Feb 21 '16 at 23:17

Instead of an application, you could always try writing a bash script.

To write and run a bash script, there are a few things to do:

  1. Open TextEdit from /Applications/Utilities/TextEdit.app and then
    press shiftcommandt (⇧⌘T) to convert it into a plain text document.

  2. Insert a shebang as the first line:


  3. Add your command below it. In the end, your script should look like:

    <your command here>

    Then save the script.

  4. In Terminal, do chmod 775 /path/to/your/script

  5. To run your script, either click on the file (which should now have an executable icon).

  • For some reason SE doesn't allow me to escape the hash but interprets it as a title character. Thanks for pointing out the plaintext mistake. Feb 22 '16 at 0:08
  • I've made edits to have it show properly for you. Feb 22 '16 at 1:30

Open Automator and choose Application for the document type.

Add a Run Shell Script Action.

Add your command line to the Run Shell Script Action so it's the only command in the action.

Save it as an Application to the desired location giving it whatever name you want.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .