How to connect to x11vnc server on Linux from OS X (macOS)?

When I’m trying to connect to x11vnc server started on Ubuntu 16.10


The “Screen Sharing” app on on OS X 10.11.6 just hangs.

enter image description here

How can I fix this?

Asked By: cubuspl42


If you want to connect to x11vnc server using “Screen Sharing” app on OS X, you need to tweak the x11vnc starting command:

x11vnc -display :0 -noxrecord -noxfixes -noxdamage -forever -passwd 123456
  • You can’t use -ncache
  • You have to use -passwd


Answered By: cubuspl42

Building off prior answer, but too long for a comment. In MacOS Big Sur 11.1, I get better performance with this:

x11vnc -display :0 -noxrecord -forever -passwd 123456

By removing -noxdamage, I see both a decrease in drawing latency and far fewer tears when resizing or minimizing windows in x11. Removing -noxfixes make a much better experience as well, because the cursor displays properly – including when the x11 cursor changes shape (e.g. to resize a window). This is very handy, otherwise you will be constantly guessing if your cursor is properly over the reside selection box. No noticeable difference (to me) from removing noxrecord, so I left it in

While the -ncache option does successfully connect, I was unable to mix ncache and multiple desktop windows. This appears to be an unexpected artifact of how desktop windows are implemented (in Y-coords, windows are "under" the main one) that conflicts with how ncache works (by also using duplicate windows under the main one).

Answered By: Hamy

I used the following to set up connections to remote systems, even those using slow internet.

x11vnc -rfbport 5900 -bg -o ~/.vnc/log -rfbauth ~/.vnc/passwd -ncache 0 -speeds modem -forever -shared -ultrafilexfer -skip_lockkeys -desktop <RemoteComputer>

This starts a VNC daemon that:

  • Sets the port to 5900 (default), but you could change it here, rfbport
  • runs the server in the background, bg.
  • logs what’s going on, o.
  • uses a password sored as encrypted hash, rfbauth.
  • disables pixel cache, an issue on OSX, ncache.
  • adapts data transfer to low speeds, speeds modem.
  • does not close the connection once you’re done, forever.
  • accepts an unlimited amount of connections, shared. That’s a thing, e.g., when your actual connection breaks and the server did not close it yet, you wouldn’t be able to reconnect right away.
  • enable file sharing ultravnc, ultrafilexfer. Does not seem to work with macs though.
  • ignores lock keys of the remote computer like caps lock etc., skip_lockkeys.
  • and gives your remote computer a name, desktop.

You can set an encrypted password via

x11vnc -storepasswd

And stop the server via a simple kill signal (-SIGTERM). Enjoy!

Answered By: helius
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.