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


Click here to return to the 'starting os X apps from command line' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
starting os X apps from command line
Authored by: palott on Dec 22, '02 03:58:42PM

I just started using os X, after several years of using other versions of unix. Thus, I work from the command line most of the time and I'm trying to understand what the MacOS executables are doing so I can startup an app from the command line. I was able to run text edit from the line using

/Applications/TextEdit.app/Contents/MacOS/TextEdit

Everything works fine, I have the nice TextEdit bar at the top of my screen and life seems good. QuickTime, iTunes, and several other apps work the same way.

However, when I try to startup mozilla (and other programs I installed on my system), I get an error, or a non-gui version of the program:

/Applications/Mozilla.app/Contents/MacOS/Mozilla

I get an error

zsh: exec format error: /Applications/Mozilla.app/Contents/MacOS/Mozilla


I did the same proceedure for an editor program gvim, but instead of opening up the gui version, it sends me to the terminal version vi.

Any ideas what I'm doing wrong? Where am I supposed to install my programs? I've been downloading the tar.gz file into a download directory and then copying the Pgm.app folder to /Applications is this wrong? All the programs I install this way work fine from Finder, but something isn't working quite right from the command line.


Thanks,

Aaron



[ Reply to This | # ]
starting os X apps from command line
Authored by: mingking on Dec 22, '02 09:12:40PM

You're going too deep by referencing the raw exectuable inside the bundle. Just use the 'open' command and it will do what you need. E.g.:

open -a Mozilla

The app may need to be in the Applications folder otherwise you may need to provide a full path. But I tried launching applications that were on the Desktop and it worked fine.

You can also just open a file and it will use the default application. E.g.

open foo.txt

and it will open in TextEdit.

See the man page for the options to the open command.



[ Reply to This | # ]
starting os X apps from command line
Authored by: palott on Dec 23, '02 01:07:25AM

Thanks!

open -a works like a charm

Aaron



[ Reply to This | # ]
starting os X apps from command line
Authored by: mingking on Dec 22, '02 09:26:59PM
I downloaded vim from this site and it worked fine. Launched using 'open -a vim' while the app is still in a folder on the Desktop and never having been in my Applications folder. Is this the one your were having troubles with? If you want to use the X version of vim you will need to install XDarwin, but that doesn't seem necessary given the Carbonized version that is available from the above link. And of course you could make an alias to that command in your shell if you'd like to make launching it a bit easier.

[ Reply to This | # ]