3

I would like to have an item in the /Applications folder that will open a new terminal window and run a specific command inside. How can I create this?

6
  • Do you need the terminal window or just run the command line program?
    – mmmmmm
    Commented May 11, 2011 at 16:29
  • @Mark I need the terminal window so I can see the output of the command.
    – ændrük
    Commented May 11, 2011 at 16:35
  • Forgive me for the quesion - but what is the "applications menu" and how is it different from a text document containing the command you wish to execute?
    – bmike
    Commented May 11, 2011 at 16:48
  • @bmike By "Applications menu" I am referring to this contraption. What do you call it? Applications place?
    – ændrük
    Commented May 11, 2011 at 17:00
  • @ændrük That's just the /Applications folder. (no trolling or patronizing intended)
    – Petruza
    Commented May 11, 2011 at 17:40

5 Answers 5

3
  1. Create a new text file starting by #!/bin/bash and followed by your command

    #!/bin/bash
    
    echo 'Hello world'
    
  2. Save with .command or .tool as extension like myEchoCommand.command

  3. Set execute right on this file with chmod command.
  4. You just have to double-click this newly created file, Terminal will open and execute it's content.
3

Use Automator which Apple made part of OSX..

Create a workflow

In the workflow choose Utilities/Run Shell Script

Save as changing the File format to application - this will give a .app and choose the directory to be /Applications

EDIT to show the output. The workflow need sto consist of three steps

1) Text->Create New TextEdit Document
2) The Utilities/Run Shell Script
3) Text->Set Contents of Textedit Document

2
  • ... and copy the resulting .app file into the folder /Applications so it shows up where you (op) said
    – Petruza
    Commented May 11, 2011 at 17:41
  • It's not clear to me how to cause the Automator workflow to open a new terminal window and run the command inside. Can you please elaborate on this?
    – ændrük
    Commented May 11, 2011 at 19:06
2

Playtypus

It can be used to create native, flawlessly integrated Mac OS X applications from interpreted scripts such as shell scripts or Perl and Python programs.

1

Most people just put a shell script in whatever folder they desire and make is executable with chomd a+x. You can use any old text editor and save the script as plain text. If you don't want to store the scripts in the /Applications folder that's fine as well - it won't matter where you store them as long as they are readable and executable.

If you save the file as script.bash.command - you won't have to associate terminal with .sh or .bash since it runs command files by default. When the script ends, the terminal session is logged out, so it will run the command and exit letting you see the results but if you want a working window you have to open another window in terminal.

Will that work for you?

-1

Maybe you need something like DTerm? It's just a shortcut away to invoke and freely installable from the AppStore. You can include it in your startup items and use it when you need it. If your command gives some output DTerm shows that in a floating window.

2
  • DTerm is just a terminal and does not produce an app
    – mmmmmm
    Commented May 11, 2011 at 18:52
  • I know that, but if you check the 2nd comment to the question you would think that the person needs to see an outcome of a command not a program/app. In that light this solution could be useful without running an Automator script. Commented May 11, 2011 at 19:04

You must log in to answer this question.

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