Feb 26, 2013

Connecting to the built-in Mac VNC server from a Windows machine

A little-known fact about Mac versions 10.4 (Tiger) and over, is that they come with a built-in VNC server. This feature is included in a couple of the “Sharing” options and can be accessed with a regular VNC viewer/client.

However, when connecting from a Windows machine (particularly when running TightVNC as the viewer), I found I had to configure a few extra settings to make it work without constant freezes on my Mac, forcing me to hard reset. Here are some of the tweaks I had to make to ensure I could connect without issues. I am running 10.7.5 (Lion), so your steps may vary slightly.

Firstly, you need to allow VNC connections. The two options are either Screen Sharing or Remote Management. Screen Sharing is what the “average” VNC user may need, while the latter is helpful if you need more permissions and control over the host machine.

Allowing VNC connections:

    Step 1 – Go to your System Preferences and under the Internet and Wireless heading, click on Sharing.
    Step 2 – Enable either the Screen Sharing or the Remote Management checkboxes.
    Step 3 – Click on Computer Settings and enable “VNC viewers may control screen with password.”
    Step 4 – Provide a password and click “OK”.
    (Only for Remote Management)
    Step 5 – Click on Options and enable any other permissions you may need.

You should now have a VNC server running on the standard port 5900 of your machine. You should (in theory) be able to connect to your Mac with any viewer using your machine’s IP address and the port. As I mentioned before, I had some issues connecting from Windows, and had to take a few precautions. I’m using TightVNC, so these changes may or may not be necessary on other viewers.

Tweaks for Windows:

  • To prevent receiving a patterned, gray screen after the login, be sure to logout of your current user on your Mac first. The viewer will prompt for a password, but once connected, will not display the actual desktop unless no users are logged in on the host.
  • In the Options menu:
    • Enable “Disable clipboard transfer.” This was a major issue that would cause freezing immediately upon on connect unless enabled. Of course, you will not be able to share the clipboard across the host and client machines, but at least the host machine will continue running properly.
    • Set the “Preferred Encoding” to either “Raw” or “ZRLE”. The other options appeared to work, but seemed to cause some minor freeze-ups on the Mac.
  • Oftentimes after closing the viewer, the Mac would freeze yet again, requiring a reset. One workaround is to click the “Pause” button (double red bar) in the active Viewer before closing the connection. Have not yet gotten a chance to look into why this works, but it seems to solve the problem for the time being.

Following these steps should help ensure you can connect to your Mac from a Windows machine.  Just enter <host IP>:5900 as the Remote Host and enter the password from before to connect.

Of course, another option is to simply user a third-party VNC server, but if you don’t feel like installing more software, hopefully this should help in preventing a few headaches.

Igor Shults

About the Author

Object Partners profile.

One thought on “Connecting to the built-in Mac VNC server from a Windows machine

  1. Fred Johnson says:

    When I try to login to my Mac from my work PC, TightVNC Viewer gives me the message:
    Error in TightVNC Viewer: A connection attempt filed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

    1. Steve Mariotti says:

      Try requiring a password on the Mac side. The Windows client will ask for it, and it’ll work.

  2. Roger says:

    I got an error: “Error in TightVNC Viewer: No security types supported. Server sent security types, but we do not support any of their.”

    Did I misconfigure something? Can I fix this if I only have shell access to the mac?

  3. eXpired56k says:

    Apparently firewall in stealth mode prevents TightVNC from connecting to Mac VNC server. You can play with rules or disable firewall stealth mode (however that lowers firewall security on your Mac). When I was trying to get mine working after disabling stealth and setting up screen sharing and password on my Mac, I was able to connect using COMP_NAME::5900

  4. sebus says:

    Never managed to get Clipboard sharing to work in ANY mac OS, using RealVNC on Windows

  5. tommy shelby says:

    Connecting the MAC server from a Windows system is not that hard as it appears. The users just need to follow the process and details which have been provided here. The steps are very easy and the server will connect. If have any issue then contact https://itunessupport.org/blog/fix-itunes-error-9/

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Blog Posts
Android Development for iOS Developers
Android development has greatly improved since the early days. Maybe you tried it out when Android development was done in Eclipse, emulators were slow and buggy, and Java was the required language. Things have changed […]
Add a custom object to your Liquibase diff
Adding a custom object to your liquibase diff is a pretty simple two step process. Create an implementation of DatabaseObject Create an implementation of SnapshotGenerator In my case I wanted to add tracking of Stored […]
Keeping Secrets Out of Terraform State
There are many instances where you will want to create resources via Terraform with secrets that you just don’t want anyone to see. These could be IAM credentials, certificates, RDS DB credentials, etc. One problem […]
Validating Terraform Plans using Open Policy Agent
When developing infrastructure as code using terraform, it can be difficult to test and validate changes without executing the code against a real environment. The feedback loop between writing a line of code and understanding […]