Connect your Raspberry Pi 4 to your Mac in 2019

Connect your Raspberry Pi 4 to your Mac in 2019

Jan Baelemans
Raspberry Pi
Dutch

How to connect your Raspberry Pi in a local network and access it through screen sharing and file-sharing on MacOS? And this in de end of the second decade of the new era.

It's quite simpel. Most of the software is native, i.e. it is already present.

If you have to install software, the commands are given.

If you're not sure if it is already present, just install. Apt-get install <package> will update, ignore or install to the latest version. Whatever needed.

Demonstruction

This demonstruction (thanks van Kooten & de Bie, dutch comedians who combined the words instruction and demonstration to demonstruction) is based on as little as possible extra software on your RPI, MacOS Mojave, NOOBS v3.2.0 with Debian Buster.

Components

The setup exists of three components:

  1. Screensharing
  2. filesharing
  3. Bonjour

Screensharing

Screensharing is done with the native vnc on both MacOS and RPI. No additional software like tightvnc or other is neccesairy. It's all already there. On your rpi go to the config-file (raspberry-menu (top left)->presets->Raspberry Pi configuration program.

On the tab "interfaces" enable VNC. Then go to the icon of VNC in the top right corner (maybe after a restart?). Follow the instructions here (scroll down a bit till the post ("KISS rule applied" but security doesn't need to be turned off as mentioned later!).

Now screen sharing works! Try it on your Mac. Start screen sharing (if you can't find it? In Finder (network?) first connect to another computer in your local network and then in the Screensharing-menu choose "new"), fill in <your rpi name>.local, type the password et voila.

Filesharing

Filesharing is done with SMB, since Apple dropped support for AFP in favor of AFS (harddrive) and SMB (network). The Linux implementation is called Samba. This is the only software to install (however may it already be active on the rpi).

Instructions on how to install here. However in Raspian Buster the module is placed in /etc/cron.daily/ instead of /etc/init.d/, so "sudo /etc/init.d/samba restart" must be changed to "sudo /etc/cron.daily/samba restart".

Bonjour

Bonjour or Zeroconfig is an Apple protocol to let pc's and more announce there presence and services on a local network.

If your interested? Here's some good explanation about what and how of Bonjour.

Avahi is the linux-implementation of this protocol. So, if not already present, install! (Terminal: sudo apt-get install avahi-daemon Avahi-utils, the latter gives you some extra's to check if needed).

Now the only thing left is to let the VNC-services announce itself through Bonjour:

To register the VNC server as a Bonjour service, create the following file in /etc/avahi/services/rfb.service (you will need to save the file as root, so use sudo before opening your editor).

<?xml version="1.0" standalone='no'?>

<!DOCTYPE service-group SYSTEM "avahi-service.dtd">

<service-group>

  <name replace-wildcards="yes">%h</name>

  <service>

    <type>_rfb._tcp</type>

    <port>5900</port>

  </service>

</service-group>

Conclusion

On the net there are a lot of ways to let your rpi talk to your Mac. Some are a bit outdated. Debian/Raspbian evolved, Apple has some major changes since Snow Leopard and its successors. The good thing is there is less to be installed and more is native.

Enjoy