# running apps from Terminal



## BaddaWho (Jan 15, 2004)

I tried running an application from the terminal window and it doesn't start. However if I go to the same location in the finder and launch the app it works.
Anyone know what's going on here?


----------



## brianleahy (Jan 15, 2004)

BaddaWho said:
			
		

> I tried running an application from the terminal window and it doesn't start. However if I go to the same location in the finder and launch the app it works.
> Anyone know what's going on here?



OSX apps are actually "packages" (fancy folders) and not unix executables.

Try typing "open <osxappname>" and return.


----------



## BaddaWho (Jan 15, 2004)

Cool, it works!
Someone had said to me to uses 'su' to become root and try that. But I'm not able to do the su.

It asks for a password and when I put it in, it tells me sorry. Although mine is the only account on the system. When installing I only created the one account.


----------



## naodx (Jan 15, 2004)

su (super user) switches you to the root user, if you don't have the root account enabled then you won't be able to use su. By default this is turned off, and should be for most people, as there is no need to have root enabled. You can do some serious damage to your OS if you enable root and type in the wrong command, e.g. if you go to rm (remove) something, there are no dialog boxes asking you if you are sure if you want to delete the file or not. Once you type: rm file.extension it is gone, and with being the root user you can delete any file even something that is critical to the OS.

I can't remember the exact pattern, but there is a way to remove every single file on a unix system using the rm command.


----------



## HateEternal (Jan 15, 2004)

rm -R /   maybe? recursively removes files and folders, one would have to be an idiot to type that or i have the syntax wrong... here let me check to see if it works...


----------



## naodx (Jan 15, 2004)

well did it work????? hello??? must have....


----------



## Matsaki (Apr 10, 2005)

Can I add a syntax so I also can see all files that is activated when opening an application. i.e. I make % open /Applications/iTunes.app

And then I see that "itunes.plist" etc. is used/activated? The question is because some times there is hidden files and prefs used with an application that I want to see.


----------



## lurk (Apr 11, 2005)

Try "man lsof"


----------



## Matsaki (Apr 11, 2005)

Sorry

PB-G4:~ mats$ man isof
No manual entry for isof

Do You know if it's possible what I want to do?


----------



## cfleck (Apr 11, 2005)

"L"sof ->lsof not "I"sof


----------



## Matsaki (Apr 11, 2005)

Ok thanks, I got it but sorry,, I don't understand anything


----------



## ElDiabloConCaca (Apr 11, 2005)

Just type lsof by itself, then, and it will list all the files and resources used by all currently running processes.


----------



## Matsaki (Apr 11, 2005)

Aha I understand. But it did not work. It don't list the prefs. (plist) etc. used for an app. I want to find out ALL the files which is used by a sertain application.

Maybe there is another way??


----------



## scruffy (Apr 11, 2005)

Well, that shows you all the files the app currently has open.  If it opens the prefs, then closes them, you probably missed it.

check the manpages for ktrace and kdump - this will let you trace every system call an application makes, including all the open() calls on files.  It gives you a lot of information, so prepare to dig through lots of data.

ktrace -tc /Applications/iTunes.app/Contents/MacOS/iTunes

should do it...


----------

