MacOS – Check Remote Management Status via Terminal

macosremote desktopterminal

I need to be able to SSH into a Mac (Mountain Lion) and check if ARD is running and if so, what are the settings. Basically, I need the equivalent of going to System Preferences -> Sharing -> Remote Management and visually inspecting the options set there. But I need it on the Terminal so I can do this via SSH.

Note, I am not asking how to set these options (e.g. through the ARD "kickstart" executable), I am asking how, once it is running, to determine what options it is running under.

ps -axlww | grep ARD shows only /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/MacOS/ARDAgent without any flags shown.

Is there a plist file where this is stored? So far I've checked …

/Library/Preferences/com.apple.ARDAgent.plist
/Library/Preferences/com.apple.RemoteManagement.plist

… and similar files within the user's ~/Library/Preferences/ directory, and they do not seem to contain anything useful.

Best Answer

You can tell if it's enabled by running launchctl list | grep '^\d.*RemoteDesktop.*'. That will output a line if there's an active process for the RemoteDesktop agent, and will output nothing if not. There's an active process for the agent whenever Remote Management is enabled, even if there's no active connection (unlike something like Screen Sharing, where the process is only active when there's a connection made).