A Mac Geek’s guide to VNC on the Pi

Do the following in order to get VNC working on your Pi, advertised over Bonjour.

  • Plug Pi in to network and power
  • ssh into your Pi after finding out its IP address by looking at your DHCP server’s leases or scanning for the Pi using nmap (http://nmap.org/download.html#macosx)
    e.g.

    $ sudo nmap -p22 --open 10.0.1.0/24

Nmap scan report for 10.0.1.2
Host is up (0.0039s latency).
Not shown: 98 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
MAC Address: B8:27:EB:4C:3D:1C (Raspberry Pi Foundation)

$ ssh pi@10.0.1.2
pi@pi ~ $ sudo raspi-config
  • Enable the Pi to boot to desktop rather than stop at the CLI
    Set hostname to something unique from the advanced menu option
  • define http proxy if required. Either edit .bashrc or use your preferred method.
  • Update stuff and install required packages
    sudo apt-get update
    sudo apt-get install avahi-daemon
    sudo apt-get install x11vnc
  • Copy the supplied avahi service file
    sudo cp /etc/avahi/services/udisks.service /etc/avahi/services/rfb.service
  • Edit the file and change udisks-ssh to rfb and 22 to 5900. Save.
    sudo service avahi-daemon restart
  • Set a vnc password using
    x11vnc -storepasswd
  • Insert the following into ~/.config/autostart/x11vnc.desktop
[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=X11VNC
Comment=
Exec=x11vnc -forever -usepw -display :0 -ultrafilexfer
StartupNotify=false
Terminal=false
Hidden=false
  • Reboot Pi. Once booted the Pi should appear in your Mac’s network browser and you should have VNC access via Screen Sharing.
  • If necessary, edit /boot/config.txt to change screen resolution. I use the following settings:

hdmi_force_hotplug=1
hdmi_group=2
hdmi_mode=16

Enjoy

One thought on “A Mac Geek’s guide to VNC on the Pi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: