An open community 
of Macintosh users,
for Macintosh users.

FineTunedMac Dashboard widget now available! Download Here

Previous Thread
Next Thread
Print Thread
launching apps from terminal
#25289 03/07/13 08:23 PM
Joined: Aug 2009
OP Offline

Joined: Aug 2009
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)


I work for the Department of Redundancy Department
Re: launching apps from terminal
Virtual1 #25290 03/07/13 08:36 PM
Joined: Aug 2009
Likes: 15
Online

Joined: Aug 2009
Likes: 15
Have you looked in "man" to see what may be up?


The new Great Equalizer is the SEND button.

In Memory of Harv: Those who can make you believe absurdities can make you commit atrocities. ~Voltaire
Re: launching apps from terminal
artie505 #25291 03/07/13 10:22 PM
Joined: Aug 2009
OP Offline

Joined: Aug 2009
nothing new there unless I'm missing something. according to man, what I am typing should (still) work.


I work for the Department of Redundancy Department
Re: launching apps from terminal
Virtual1 #25293 03/08/13 12:19 AM
Joined: Aug 2009
Offline

Joined: Aug 2009
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.

Re: launching apps from terminal
ganbustein #25294 03/08/13 12:56 AM
Joined: Aug 2009
Likes: 3
Moderator
Offline
Moderator

Joined: Aug 2009
Likes: 3



dkmarsh—member, FineTunedMac Co-op Board of Directors
Re: launching apps from terminal
dkmarsh #25296 03/08/13 01:06 AM
Joined: Aug 2009
Likes: 15
Online

Joined: Aug 2009
Likes: 15
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.


The new Great Equalizer is the SEND button.

In Memory of Harv: Those who can make you believe absurdities can make you commit atrocities. ~Voltaire
Re: launching apps from terminal
dkmarsh #25300 03/08/13 01:43 AM
Joined: Aug 2009
Offline

Joined: Aug 2009
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.

Re: launching apps from terminal
artie505 #25301 03/08/13 05:15 AM
Joined: Aug 2009
Likes: 3
Moderator
Offline
Moderator

Joined: Aug 2009
Likes: 3

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



dkmarsh—member, FineTunedMac Co-op Board of Directors
Re: launching apps from terminal
dkmarsh #25302 03/08/13 06:10 AM
Joined: Aug 2009
Likes: 15
Online

Joined: Aug 2009
Likes: 15
Very helpful; thanks! smile


The new Great Equalizer is the SEND button.

In Memory of Harv: Those who can make you believe absurdities can make you commit atrocities. ~Voltaire
Re: launching apps from terminal
ganbustein #25303 03/08/13 12:21 PM
Joined: Aug 2009
OP Offline

Joined: Aug 2009
I'm not encountering a launch limit, and it's an application from my /Applications folder that I ought to be able to launch.


I work for the Department of Redundancy Department
Re: launching apps from terminal
Virtual1 #25369 03/13/13 06:19 AM
Joined: Aug 2009
Offline

Joined: Aug 2009
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.


Moderated by  alternaut, dkmarsh, joemikeb 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.4.33 Page Time: 0.026s Queries: 36 (0.018s) Memory: 0.6214 MB (Peak: 0.7154 MB) Data Comp: Zlib Server Time: 2024-03-28 09:37:23 UTC
Valid HTML 5 and Valid CSS