Open Apps via Terminal / SSH

Posted:
in macOS edited January 2014
Is it possible to open Apps on a remote machine through Terminal / SSH?



How?

Comments

  • Reply 1 of 9
    yes, and it's quite simple;



    for example;

    "open /Applications/iTunes.app"



    without the quotes - opens iTunes
  • Reply 2 of 9
    Major thanks! Made my day
  • Reply 3 of 9
    I don't have any available OS X machines to test this on, so I'm curious how this works.



    <ol type="1">[*]What if there's no logged-in session on the OS X box? Will the app silently fail, fail with some nasty message, or start but be running in some "unavailable" WindowServer space?[*]If there is a logged-in user, and the 'open' command is used on the shell by another account, what's the behavior? Does the app launch as the user logged in to the WindowServer session, or as the shell user? Or does it just not launch at all (because a WindowServer session isn't available to the shell user)?[/list=a]



    Just curious.
  • Reply 4 of 9
    You cannot open an app if no one is logged into the GUI on the host machine. You cannot launch apps if you are connected as a different user than that user. If you ssh as the game user logged in the GUI, you should have no problems.



    Oddly enough, I can't seem to get it to work for me on my Mac here. I try opening apps remotely and get a "Bus error." Any ideas from anyone here? I can "open -a /Application/iTunes.app" just fine from the Terminal on the host machine itself, just not over a remote ssh connection. I must investigate...
  • Reply 5 of 9
    How do you close an Application? And how to you see witch that are running? Top?
  • Reply 6 of 9
    mcqmcq Posts: 1,543member
    Not completely sure on this, but top will show all the current processes (programs), and if you want to quit a program, then use the command



    kill pid



    Where pid is the number corresponding to the pid of the program you want to quit (you'll see when you run top).
  • Reply 7 of 9
    [quote]Originally posted by MCQ:

    <strong>Not completely sure on this, but top will show all the current processes (programs), and if you want to quit a program, then use the command



    kill pid



    Where pid is the number corresponding to the pid of the program you want to quit (you'll see when you run top).</strong><hr></blockquote>



    This is correct, but if you're trying to kill a process that is not yours, then you'll have to sudo the [kill] command, which means you'll need an admin-account.



    This is actually a whole lot of fun on LAN-parties, when you've secretly created an admin-account on someone's mac, and ssh'ed into it when the mac's owner is playing, or showing off something. It's also very convinient to have avaliable on your own machine, in case some stupid PC-nerd comes and sits his heavy ass on your chair, wanting to "experiment" with "The stupid gay mac" (which usually means duplicating folders or starting all applications/games in the dock). Just ssh into your own mac, and kill the window manager process logged out, poor bastard.



    [ 12-25-2002: Message edited by: r-0X#Zapchud ]</p>
  • Reply 8 of 9
    Can you open the Finder from the Terminal. That would be cool so I can just stick sudo in front of that so that I can open Finder as root. I know there are other solutions but I still wanted to know.



    Dale Mox



    (edit) Spelling



    [ 12-26-2002: Message edited by: Dale Mox ]</p>
  • Reply 9 of 9
    [quote]Originally posted by Brad:

    <strong>Oddly enough, I can't seem to get it to work for me on my Mac here. I try opening apps remotely and get a "Bus error." Any ideas from anyone here? I can "open -a /Application/iTunes.app" just fine from the Terminal on the host machine itself, just not over a remote ssh connection. I must investigate...</strong><hr></blockquote>



    not sure if this'll fix it, but the "-a" is unnecessary for opening *.app's. as mentioned above:

    open /Applications/iTunes.app



    i can't think of anything ssh related that'd cause a bus error in open, unless ur client or server is memory heavy. [bus errors, at least in my programming, are usually pointers pointing to bad memory]
Sign In or Register to comment.