Jump to content

Start application from command line in Terminal - SOLUTION


sebus
 Share

10 posts in this topic

Recommended Posts

Is there something like start command line in Windows that would start graphical application from a Terminal's command line during Intaller?

 

SEE my post below

 

Thanks

 

sebus

Link to comment
Share on other sites

Guest Ramm

Well, if you navigate to you apps package contents directory (eg. Applications/Safari.app/Contents/MacOS) you can double click on that and launch the app through Terminal, however, I don't quite know how to do this straight from terminal (without navigating to the package contents through finder).

 

EDIT: Just make sure you type in the .app at the end, and you can do this straight from command line.

Link to comment
Share on other sites

Easier then we thought to open apps through Terminal, I found the command in the June 2004 issue of MacAddict. The command is:

 

$> open -a /Applications/Myprogram.app

 

And yes I confirmed this to work in 10.4.8 for Hackintoshes.

Link to comment
Share on other sites

Easier then we thought to open apps through Terminal, I found the command in the June 2004 issue of MacAddict. The command is:

 

$> open -a /Applications/Myprogram.app

 

And yes I confirmed this to work in 10.4.8 for Hackintoshes.

 

And I can confirm it works for 10.4.9. One more useful command to keep in the back of your mind when something horrible occurs to your rig and you're left with only the terminal working :thumbsdown_anim:

Link to comment
Share on other sites

The other thing I forgot to mention is that if your already CD'd into /Applications, then you don't need to specify it in the .app path, and if your say, in /Users/username, rather then /Applications, the -a specify's to open look in the default application directory. And for .app's with filenames that contain spaces, put quotations around it. Ie. for both:

 

kevin-mcclellands-computer:/Applications Kevin$ cd ~/

kevin-mcclellands-computer:~ Kevin$ open -a "System Preferences.app"

kevin-mcclellands-computer:~ Kevin$

 

And it works. :) And truth be known, I like it better that way. :)

 

Another handy trick I like is 'Saying Bye-Bye to Finder'! You can tell OS-X to load Terminal.app as the Window Manager instead of Finder by:

 

'defaults write com.apple.loginwindow Finder /Applications/Utilities/Terminal.app'

 

Type that in Terminal btw if you didn't realize. Log out and back in after.

 

To get finder back:

 

'defaults write com.apple.loginwindow Finder /System/Library/CoreServices/Finder.app'

 

 

That coupled with "open -a" should be considered a big stability and performance gainer I find.

Anyone else know any other good Terminal tips?

Link to comment
Share on other sites

That does indeed work OK when you are fully in Mac OS X, but does NOT work in Terminal when booted from Installation DVD

 

But there is a way to make it work

 

I only tried it with a boot install DVD & existing Mac OSX HD (but I believe both commands could be run from an external USB mac formatted HD (as USB FAT32 drives are recognized during install, but not mounted)

 

The command in Terminal would look like (at the bash prompt #)

 

/Volumes/20Gb-Internal/usr/bin/open -a "/Volumes/20Gb-Internal/Applications/Utilities/Disk Utility.app"

 

" " are needed as there is a space

This runs graphical Disk Utility.app 10.5.8 that is what gets installed with Mac 10.4.8/9 & this disk utility does ALLOW the destination drive to be dragged

 

So the scenatio would be:

* attach external USB drive to a fully running Hackintosh

* format it as Journaled HFS+ with Disk Utility

* create image of your HD with SuperDuper! - free for this purpose - to this external USB HD

* copy /usr/open & /Applications/Utilities/Disk Utility to the external USB drive

* physically change the HD to an empty one

* reboot to an installation DVD

* on first screen (after language of course) start from the menu Utilities/Terminal

* run the command to start Disk Utility from external USB drive:

 

/Volumes/External-USB/open -a "/Volumes/External-USB/Disk Utility.app"

 

* restore your image from External-USB to empty internal drive

 

The above works perfectly & it is the fastest way (if you do not want/do not have second Windows machine)

 

This page is a nice collection of commands:

 

h**p://osxdaily.com/2007/02/07/basic-command-line-utilities-tips-commands/

 

sebus

Link to comment
Share on other sites

Awesome link!! I especially like the front page news post about controlling the laptop fan speed..! Especially considering my laptop just burnt me something decent! Unforunatley Hackintosh's are not supported yet, but I'll see if I can find a way around that!

 

I advise everyone to check out osxdaily! Terriffic site!

 

Race Day right now till 2pm pacific, and so I'll cut this short, but after the race I'll post some more tips!

Link to comment
Share on other sites

Yeah I thought it was too till I discovered 'open' in an issue of MacAddict magazine I had lying around.

 

I noticed too that Open does not have a -help or -useage switch to specify. Instead just run open as is by itself:

 

Welcome to Darwin!

kevin-mcclellands-computer:~ Kevin$ open

Usage: open [-e] [-t] [-f] [-b <bundle identifier>] [-a <appname>] [filenames]

Help: Open opens files from a shell.

By default, opens each file using the default application for that file.

If the file is in the form of a URL, the file will be opened as a URL.

Options:

-a Opens with the specified application.

-b Opens with the specified application bundle identifier.

-e Opens with TextEdit.

-t Opens with default text editor.

-f Reads input from standard input and opens with TextEdit.

kevin-mcclellands-computer:~ Kevin$

 

Have fun!

Link to comment
Share on other sites

 Share

×
×
  • Create New...