Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question
    
Do you need the terminal window or just run the command line program? –  Mark May 11 '11 at 16:29
    
@Mark I need the terminal window so I can see the output of the command. –  ændrük May 11 '11 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 May 11 '11 at 16:48
    
@bmike By "Applications menu" I am referring to this contraption. What do you call it? Applications place? –  ændrük May 11 '11 at 17:00
    
@ændrük That's just the /Applications folder. (no trolling or patronizing intended) –  Petruza May 11 '11 at 17:40
show 1 more comment

5 Answers

up vote 3 down vote accepted
  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.
share|improve this answer
add comment

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

share|improve this answer
    
... and copy the resulting .app file into the folder /Applications so it shows up where you (op) said –  Petruza May 11 '11 at 17:41
    
+1 Automator is a great multi-purpose tool. –  Austin May 11 '11 at 18:48
    
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 May 11 '11 at 19:06
add comment

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.

share|improve this answer
add comment

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?

share|improve this answer
add comment

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.

share|improve this answer
    
DTerm is just a terminal and does not produce an app –  Mark May 11 '11 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. –  Tigran Khanzadyan May 11 '11 at 19:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.