Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I launch OS X's ScreenSharing from the command line and have it connect to a specified system?

share|improve this question
up vote 19 down vote accepted
open vnc://server.address[:port]
share|improve this answer
    
Perfect! Thanks! – Michael Prescott Dec 3 '10 at 22:07
2  
open vnc://user@pass:server:port also works if you want to pass in some credentials. The security risks of doing this is yours to consider. – Ben W Apr 28 '12 at 5:16
2  
open vnc://user@server:port is also useful and doesn't have the security risks associated with having your password show up in the process list – Michael Jan 23 '13 at 15:18
    
I never thought to type man open before today. It can do a lot. – Michael Fox Jan 12 at 18:59

If you have access for assistive devices activated in System Preferences, you can try saving the following AppleScript in AppleScript Editor and executing it via command line:

tell application "Screen Sharing"
    activate # start Screen Sharing if not running yet
    tell application "System Events"
        keystroke "a" using command down # this will cause the address to clear
        keystroke "127.0.0.1" # replace with your host
        key code 36 # press enter
    end tell
end tell

Save as Sharing.scpt, and execute as osascript /path/to/Sharing.scpt.

share|improve this answer

You must log in to answer this question.

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