Skip to content

Instantly share code, notes, and snippets.

@nateware
Created October 19, 2012 01:27
Show Gist options
  • Save nateware/3915757 to your computer and use it in GitHub Desktop.
Save nateware/3915757 to your computer and use it in GitHub Desktop.
Start Mac VNC server from command line
# Step 1: Set priveleges
$ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -allUsers -privs -all
Starting...
Setting allow all users to YES.
Setting all users privileges to 1073742079.
Done.
# Step 2: Allow VNC clients
$ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -clientopts -setvnclegacy -vnclegacy yes
Starting...
Set the client options.
Done.
# Step 3: Set VNC password (change it at the end of the line (i.e. don't use supersecret))
$ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -clientopts -setvncpw -vncpw supersecret
Starting...
Set the client options.
Done.
# Step 4: Restart service
$ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -restart -agent -console
Starting...
Stopped ARD Agent.
Stopped VNC Privilege Proxy
Stopped RFB Register MDNS
Done.
# Step 5: If no ARD services have been activated on the machine before, it is also necessary to run the following command
$ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate
Starting...
Activated Remote Management.
Done.
@spamshaker
Copy link

how to define headless resoulution?

@dansoftware
Copy link

Here is a script to set VNC password in macos 10.14 and later:
echo runnerrdp | perl -we 'BEGIN { @k = unpack "C*", pack "H*", "1734516E8BA8C5E2FF1C39567390ADCA"}; $_ = <>; chomp; s/^(.{8}).*/$1/; @p = unpack "C*", $_; foreach (@k) { printf "%02X", $_ ^ (shift @p || 0) }; print "\n"' | sudo tee /Library/Preferences/com.apple.VNCSettings.txt
Origin: https://raw.githubusercontent.com/JohnnyNetsec/github-vm/main/mac/start.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment