Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am mostly an Ubuntu user. I like that it is very easy to create one-click launchers for apps by (in Gnome, at least) right-clicking on the panel and choosing add-to-panel->custom-app. I use this A LOT. For custom one-liners and custom shell script utilities that I use day to day for work (I am a LAMP stack sysadmin)

Mac OS <= 9 used to have these "droplet" things which were similar.

I may be forced to use my Mac for a while, and I'd like to know of an easy way to create a one-click "app" launcher that launches, for example, a custom shell script, or a custom shell one liner, or even a normal app but with different CLI flags.

What is the "Mac Way(TM)" of doing something like that? I'd like to be able to add the .desktop-ish files to the Mac app bar at the bottom, or, failing that, make them clickable icons on my desktop. Is that even possible?

share|improve this question
    
All of these have been asked before, if you had bothered to rephrase your question to be less Ubuntu-focused and look for solutions; which by the way only leads to fewer Mac users on this site being able or willing to answer. –  Daniel Beck May 6 '11 at 5:36
1  
I did look for solutions, but I don't know the Mac-specific terms to be able to search. One cannot ask a question if one does not know what one is even asking. Also, my question is not Ubuntu-focused, it is Ubuntu-referencing. Which is my only real desktop frame of reference. (pissy response removed) –  JDS May 6 '11 at 12:44
    
You have a point there. But are these .desktop files really nothing more than "running programs with arguments from the GUI" and "executing shell scripts by opening a file"? –  Daniel Beck May 6 '11 at 12:45
    
The .desktop files can be as simple as "running programs with arguments from the GUI" and "executing shell scripts by opening a file", yes. They can be a little more complex, also, but not much. –  JDS May 6 '11 at 12:48
    
Then I hope my (and the others') answers provides you with a few good ideas. Please comment on mine if you have questions. –  Daniel Beck May 6 '11 at 12:49

3 Answers 3

You can use AppleScript Editor to create AppleScript script files or applications that do the following:

a) Launch an application

tell application "TextEdit" to activate

b) Run a shell command without opening Terminal

run shell script "/usr/local/bin/growlnotify 'Hello World'"

Applications can be dragged to the left side of the Dock. To execute normal scripts, enable AppleScript menu (which will be located in the menubar notification area) in AppleScript Editor's preferences. This menu is fed by using scripts in ~/Library/Scripts, it displays those e.g. in ~/Library/Scripts/Applications/TextEdit only when TextEdit in frontmost.

You can also use Automator to do this (e.g. Run Shell Script and Launch Application actions), but in my experience, it's a lot slower than running the AppleScripts themselves.


To make an executable shell script that's open the Terminal, simply chmod +x it and save with the extension .tool or .command. Optionally drag to the right side of the Dock.


To launch arbitrary shell scripts from the GUI without a Terminal, simply save them as files, and create the following application (once):

Open Automator, select Application, double-click the Run Shell Script item in the library, select to receive input as arguments and enter the following:

for f in "$@"
do
    source "$f"
done

(or something similar)

Now you just need to associate these shell scripts with this application (I called mine Shell Script Runner), and you can drag them to the Dock's file area.


To execute a Mac application (e.g. Firefox) with different arguments, use the following in shell:

open -a Firefox --args ProfileManager

Anything you can drag to the Dock, you can place on the desktop:

  • Create an alias for Applications
  • Create an alias for regular files, or just drag the files to the desktop.
share|improve this answer

You can use Automator to create a small application that simply runs a shell script. Open Automator, find the Run Shell Script action, paste in your code, save as an Application, then drag the application to your Dock.

share|improve this answer

You did not say what osx version you are using, so...

Look for AppleScript Utility.app it has the option to put a script item in the menu bar.

I have shell scripts and applescripts in that script menu, works great.

-Bill

share|improve this answer
    
snow leopard, up to date as of last month or so. –  JDS May 6 '11 at 12:49

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.