VNC service start and stop with a script in Mac OS X

Create a file called, for example, startVNC and fill it with:

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -clientopts -setvnclegacy -vnclegacy yes -clientopts -setvncpw -vncpw PASSWORD -restart -agent -privs -all

The password used to enter via VNC must be filled in PASSWORD.

Create a file called, for example, stopVNC and fill it with:

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -configure -access -off

Don’t forget to give executable permissions to both:

chmod +x startVNC
chmod +x stopVNC

I use those scripts when I need to do something in the graphical interface but I’m far away from my computer. Just enter by SSH, start VNC service, do what I need and stop VNC again.

You might also like

Install MongoDB in Ubuntu 12.04 with PHP driver
Install MongoDB:sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 echo...

Useful Apache 2 and MySQL 5 service aliases for MacPorts
Those are some aliases I use to start, stop and restart Apache 2 and MySQL on my MacPorts installation...

Useful Apache 2 and MySQL 5 service aliases for MacPorts
Those are some aliases I use to start, stop and restart Apache 2 and MySQL on my MacPorts installation...

Run Solr as a service in Ubuntu
I've been doing some tests with Nutch and Solr these days. One thing I didn't like was that when you...

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.