How do I set up VNC with Mac OSX?

Linode Staff

Could you help me with connecting to a Linode using VNC Viewer (Ubuntu 19.04) from Mac OSX?

2 Replies

Sure, I'd be happy to help!

Before you begin

Before you begin, I would suggest updating your system using the command: sudo apt-get update && sudo apt-get upgrade. I would also suggest reviewing our Getting Started guide and complete the steps for setting up your Linode's hostname and timezone. Further, please refer to our Securing Your Server guide to create a standard user account, harden SSH access, and remove unnecessary network services.

Installing a desktop and VNC Server on your Linode

  1. Ubuntu has several desktop environments available in its repositories. The following command installs the default desktop, Unity, as well as the dependencies that are required for the graphical interface to work properly:
    sudo apt-get install ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
  • Note: Please keep in mind that this command will install the full Ubuntu desktop environment, including office and browsing tools. To install a bare desktop without these packages, run:
    sudo apt-get install --no-install-recommends ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal

  • During the install process, you will be asked whether or not to change a file to the new version:

Configuration file '/etc/init/tty1.conf'
==> File on system created by you or by a script.
==> File also in package provided by package maintainer.
What would you like to do about it ?  Your options are:
Y or I  : install the package maintainer's version
N or O  : keep your currently-installed version
D     : show the differences between the versions
Z     : start a shell to examine the situation
The default action is to keep your current version.
*** tty1.conf (Y/I/N/O/D/Z) [default=N] ?

Type Y then press enter to use the updated version.

  1. Install the VNC server: sudo apt-get install vnc4server

Securing your VNC connection

The VNC Server generates a display, or graphical output, identified by a number that is defined when the server starts. If no display number is defined, the server will use the lowest one available. VNC connections take place on port 5900 + display. This guide will use a display number of 1; therefore, you will connect to port 5901.

The default VNC connection is unencrypted. In order to secure your passwords and data, you will need to tunnel the traffic through an SSH connection to a local port. You can use the same local port for consistency.

Connecting Linode to Mac OS X

  1. From your desktop, connect to your Linode with the following command. Be sure to replace with your username and your Linode's hostname or IP address: ssh -L 5901:
  2. From your Linode, launch the VNC server to test your connection: vncserver :1 You will be prompted to set a password.

Connect to VNC from your Desktop (Mac OS X)

While there are many options for VNC Viewer clients, this guide will use RealVNC Viewer

  1. After installing and opening the viewer, connect to the localhost through your VNC client. The format is localhost:#, where # is the display number we used in the previous section, Secure your VNC connection.
  2. You will be warned that the connection is unencrypted, but if you have followed the steps above for securing your VNC connection, your session will be securely tunneled to your Linode. To proceed, press Continue.
  3. You will be prompted to enter the password you specified when first launching the VNC Server on your Linode.

After connecting, you will see a blank gray screen since the desktop processes have not yet been started.

Configure VNC for a full desktop

  1. Once you've successfully connected, exit the connection. Close the VNC server using this command: vncserver -kill :1

  2. Edit the end of your ~/.vnc/xstartup file to match the following configuration. This starts the desktop dependencies as background processes upon starting the VNC server:

    # Uncomment the following two lines for normal desktop:
    # exec /etc/X11/xinit/xinitrc
    [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
    [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
    xsetroot -solid grey
    vncconfig -iconic &
    x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
    x-window-manager &
    gnome-panel &
    gnome-settings-daemon &
    metacity &
    nautilus &
  3. Save and exit the file. Begin another VNC session: vncserver :1

  4. Connect from your local VNC client using the same steps from the previous section, Connect to VNC from your Desktop (Mac OS X).

For more information on this process, please refer to our guide for Installing VNC on Ubuntu. Please note: The guide refers to Ubuntu 18.04, but I was able to successfully set up VNC on Ubuntu 19.04 using that guide.

Before anybody wastes their time following the above steps, please be aware that they do not work at all. Attempting to connected to your Linode by the above steps from MacOS X generates a "connection refused" error.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct