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

Advertisements

Remote control your Pi using your Mac

This is the first of what will hopefully be a series of posts by me. There will be an emphasis on the more technical side of things but, with any luck, things will be explained in plain English. I like to think that even though I am a geek by day I can still see things from the perspective of a ‘normal’ person 🙂

I have been asked by a couple of schools to give them guidance and/or training on how best to use their Pis without having to beg, borrow or steal monitors, keyboards etc when they already have a perfectly (good?) functioning suite of computers. As I tinker with Apple kit all day long, a lot of these posts will be weighted towards making a Pi work with Macs.
Continue reading “Remote control your Pi using your Mac”