Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Open GUI apps from the terminal System
You can open any of the standard GUI applications (such as Mail, Explorer, Address Book, etc.) from a terminal session. Although this may not have great benefits in day to day use (why not just click the dock icon?), it does imply that you could write a shell script to open a GUI app, and then use the UNIX cron program to schedule the 'open' to happen on a shedule. If the GUI app you open then had some command it executed at startup, this might prove to be a worthwhile trick.

In any event, to open a command in the terminal, just type
open /path/to/application/bundle
For example, to launch the Calculator or the game, type one of the following:
open /Applications/
open /Applications/GrabBag/
As I said, I'm not completely certain about why or how useful this is, but it is somewhat interesting. It even opens the application in the background, so you don't switch out of your terminal window.
  • Currently 2.00 / 5
  You rated: 3 / 5 (6 votes cast)

Open GUI apps from the terminal | 3 comments | Create New Account
Click here to return to the 'Open GUI apps from the terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Authored by: Anonymous on Feb 06, '01 04:10:11AM

It can be quite useful as most old unix hacks know. We will in the future be getting applications that will be non-GUI tools, or GUI apps will, if launched a certain way, not bring up their GUI. These will be for things that have to be done in the background, perhaps on a schedule, scientific data gathering for instance. Or activating your video camera or house lights for instance. You could also telnet in, and launch the function remotely. I just recently wrote a quick&dirty tool to take screenshots without user interaction. This way I was able to get a screenshot of my login window by launching the tool from cron. I did have to launch it as root, since apparently users don't have access to the screen content when they don't own it.

[ Reply to This | # ]
Authored by: torifile on Feb 09, '01 12:25:56AM

I personally like the feature because I can't figure out how to force quit an app using the kill command. So, if classic is acting up, I just open process viewer and force quit from there. Also, launching trublue via an alias through the command line is easier than clicking through to the resource in the finder.

[ Reply to This | # ]
Opening URL
Authored by: Anonymous on Mar 28, '01 03:44:47AM

Is it posible to open a URL with this?


% open /Applications/Internet Explorer/Internet -f ""
(doesn't work).

I really really really need to be able to do this to be able to switch from windows to MacOS X at work. (Java 2 applet has an editable field to launch a browser window in a url. I need to make that work).


[ Reply to This | # ]