Is there a way to run a GUI app, like iTunes, when not logged in to a computer directly? Thus, I'd like to be able to start a program, then log out, or (preferably) run a GUI program directly from an SSH session when no user is logged in to the console itself.

(Note that I'm not looking for a music player in particular, but a general method of running GUI programs.)


6 Answers 6


You need to set up a VNC server and connect using a client or buy the Apple Remote Desktop.


This does not work for GUI apps. There are some command line apps that will play music etc. but not iTunes.

If you have a machine that is headless and you can hit it with VNC or Screen Sharing to log in, then you can use open /Applications/iTunes.app to launch application from ssh in the current users GUI with out logging in to the GUI. However you need the right permissions.

  • I'm not looking to play music, necessarily. I was looking more to be able to download stuff from the Store while logged out, or something. Apr 30, 2009 at 21:57

You can combine setatakahashi's answer above with OS X's fast user switching, since you mentioned that you were prepared to first log into the machine you would like to control.

Log in to the machine you want to control. Fire up a VNC server like OSXVNC and set the port to 5902 or something of your choice that isn't the default 5900 used by the VNC server included in all Leopard Macs. (And which can be enabled by any admin user: Sharing pref pane=>Screen Sharing=> Allow VNC client to connect.) Set a password.

Enable fast user switching (Accounts pref pane=> Login options) and then, from the FUS icon in the menubar, choose "Login Window". The computer will then present Mac OS X's login window and allow others to log in and out normally without interrupting your session. (If the machine's preferences are set to display empty name and password fields, your active, hidden session will likely go unnoticed till someone logs in and clicks the FUS icon.) Your console session remains active, as does your VNC server. You can now control that session using a regular VNC client pointed at the right port on the remote machine. JollysFastVNC is a good, fast choice if your controller's also a Mac.

There are many security considerations, starting with a strong recommendation to use an SSH tunnel. Each account on the remote machine needs a password to stop users switching willy-nilly, users can kill your session by shutting down, sleeping, etc. Reliance on a wireless network might kill your connection, depending on how things are set up. The other stuff is probably outside the scope of this question. :)


Is the computer running truly headless (as in WindowServer is never started - usually Xserves) or is it simply a computer that doesn't have a user logged into?

The short answer is no. Mac OS X 10.5 will specifically disable applications from opening up and running over top of loginwindow. (Which was a rather annoying security hole when installers cough Flash cough would open a Finder window over loginwindow giving anybody walking by root access)



$ ssh -X myuser@mypc
$ run_something

I don't know if that works on OS X, since I'm a Linux user, but give it a try. Also, if you're going to do this outside a LAN (fast connection), try NoMachine.

I'm afraid this question will be closed do, given that it's not really sys admin related... let's hope not.

Oh, and I'm sure there are several good VNC apps for the Mac, so that's another option.

Also, take a look at DynDNS in case you have a dynamic IP and need access over the Internet.

  • I don't think X forwarding works on a Mac. :( Apr 30, 2009 at 22:50
  • I don't know either, but remember that macs don't ship with an X server installed by default. You need to install it from the disc. Perhaps you could get it to work then? (although I suspect you would only get X apps, and not Aqua, anyway)
    – John Fouhy
    May 1, 2009 at 1:33
  • Indeed this would only work with X apps you would need to use VNC or apples remote desktop thing
    – Nathan
    May 6, 2009 at 16:21

You might be able to open the app up with the open command line command.

open /Applications/iTunes.app

You might also want to look into Automater or AppleScript to do these kinds of actions.

  • When no one is logged in this will fail.
    – Chealion
    Apr 30, 2009 at 23:24
  • I seem to remember it workings, but I could be wrong. Apr 30, 2009 at 23:46
  • I remember this working as well, although you needed sudo access to do it. However, I just tried it with a Leopard machine and while the menu bar appears the main window of the app does not. If all you need is the app to be running (i.e. iTunes for sharing or bittorrent) then this might work. May 1, 2009 at 0:49
  • It used to work in 10.4, in 10.5 they added a security feature to loginwindow that will not allow applications from opening over top of the loginwindow process. This avoids massive security holes such as Finder opening as root when doing a remote install of Flip4Mac or Flash.
    – Chealion
    May 11, 2009 at 14:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .