Sometimes you need to enable vnc but do not have access to gui or just want to automate this process.
Here is one line command to do this:
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -restart -agent -privs -all -allowAccessFor -allUsers -clientopts -setvncpw -vncpw 123pass -setvnclegacy -vnclegacy yes
Note about -vncpw
option. This will enable vnc with password 123pass
.