Home
Posted By: Virtual1 launching apps from terminal - 03/07/13 08:23 PM
it seems that changes have been made in 10.8 that killed the "open" command in terminal.


iTech-Demo-2:~ root # open /Applications/Messages.app
LSOpenURLsWithRole() failed with error -10810 for the file /Applications/Messages.app.
iTech-Demo-2:~ root # open /Applications/Messages.app/Contents/MacOS/Messages
LSOpenURLsWithRole() failed with error -10810 for the file /Applications/Messages.app/Contents/MacOS/Messages.


It seems that Open no longer will open applications from terminal.


iTech-Demo-2:~ root # open /Library/Desktop\ Pictures/Blue\ Pond.jpg
LSOpenURLsWithRole() failed with error -10810 for the file /Library/Desktop Pictures/Blue Pond.jpg.

nor will it open documents.... so is Open completely broken? How do I launch an app? Anyone got an osascript handy? (I assume a tell to Finder or System events or something)
Posted By: artie505 Re: launching apps from terminal - 03/07/13 08:36 PM
Have you looked in "man" to see what may be up?
Posted By: Virtual1 Re: launching apps from terminal - 03/07/13 10:22 PM
nothing new there unless I'm missing something. according to man, what I am typing should (still) work.
Posted By: ganbustein Re: launching apps from terminal - 03/08/13 12:19 AM
I'm not sure what Error -10810 is (it isn't listed in MacErrors.h), but it's pretty clear what the problem is. You're trying to open a GUI application while the GUI belongs to a different user. (In your case, you're trying to run Messages.app as root. What exactly do you think that's going to do?)

If you run exactly the same command from a shell running as the GUI's user, it works fine. Run it from any other user, and it fails.
Posted By: dkmarsh Re: launching apps from terminal - 03/08/13 12:56 AM

Some info here:

Error -10810 Openng Applictions or Relaunching Finder.
Posted By: artie505 Re: launching apps from terminal - 03/08/13 01:06 AM
Out of curiosity (and maybe I'll learn something) what search term did you use to find that?

I searched and came up 100% empty.

Thanks.
Posted By: ganbustein Re: launching apps from terminal - 03/08/13 01:43 AM
Originally Posted By: dkmarsh

Some info here:

That article starts by saying -10810 means Launch Services encountered an unknown error, mentions that exhausting your process table could be one cause of it, and then spends the rest of the article talking as if that was the only cause.

To see if you're even close to this limit, first find out how many processes are permitted with EITHER of the commands

getconf _CHILD_MAX
ulimit -u


That's a per-user limit, and is 709 on 10.8.2, up from 266 on 10.6.8. You can see how many a given user is using with:

# Count your processes
ps -x | wc -l

# Count some other user's processes (root's, for example)
ps -xu root | wc -l

# Count all processes
ps -xa | wc -l

I'm nowhere near the limit, yet got this error code trying to launch a GUI application from a different user and from root.
Posted By: dkmarsh Re: launching apps from terminal - 03/08/13 05:15 AM

My search string was "error -10810" including quotation marks. error -10810 doesn't work because Google uses the minus sign to signify NOT, so you're essentially telling it to find all results for the word error which don't include the number 10810.

Let's not get into a discussion of search techniques in this thread, though. wink
Posted By: artie505 Re: launching apps from terminal - 03/08/13 06:10 AM
Very helpful; thanks! smile
Posted By: Virtual1 Re: launching apps from terminal - 03/08/13 12:21 PM
I'm not encountering a launch limit, and it's an application from my /Applications folder that I ought to be able to launch.
Posted By: ganbustein Re: launching apps from terminal - 03/13/13 06:19 AM
Originally Posted By: Virtual1
I'm not encountering a launch limit, and it's an application from my /Applications folder that I ought to be able to launch.


YOU ought to be able to launch it. "root" doesn't have a GUI environment to launch it in. Re-check your transcript. You're invoking open from a root shell.
© FineTunedMac