Many Raspberry Pi installations run as remote systems, which means that you don't have access to their screens. But sometimes, it may become useful or necessary to see what comes up on the display. This is what screen sharing is for.
It used to work without a hitch a few years ago, but then some changes were introduced either on the Raspbian or the macOS side, and it stopped working for me.
In this article, I will show you how you can see your Raspberry Pi's screen from your macOS computer without installing any extra software.
I have tested this setup with a Raspberry Pi Model 4 and the latest Buster release.
Several articles on the Internet talk about the need to install extra VNC software, but this is not necessary. Both the Raspberry Pi and the Mac are shipped with all it takes.
Two important points upfront:
First, you can only see the screen of your Raspberry Pi if there is a screen connected to it. The monitor may be turned off but, the power supply of the monitor may even be unplugged, but you still need the normal HDMI connection between your Raspberry Pi and the monitor.
And second, your Raspberry Pi must boot into the desktop, not the console.
To check this boot setting, enter
in the Terminal window and select (3) Boot Options > B1 Desktop/CLI and then B4 Desktop Autologin.
While you are in the configuration module, select (7) Interfacing Options > P3 VNC and enable the VNC Server. Close the configuration and reboot.
The VNC program of the Raspberry Pi requires a bit of a configuration before you can connect. I will describe how to do this remotely when you are ssh'ed into your Pi via Terminal.
If you don't enter the commands below, you will get a message that "The software on the remote computer appears to be incompatible with this version of Screen Sharing".
This is a tad confusing and may lead people to think that a special VNC viewer must be installed. But the fix is very easy.
Open a Terminal window and connect to your Pi. Generate a password for your connection. I believe it must have a minimum of six letters.
sudo vncpasswd -service
Open this file
sudo nano /etc/vnc/config.d/common.custom
and add this line:
Now restart the VNC service.
sudo systemctl restart vncserver-x11-serviced
Opening Screen Sharing on your Mac
Open the "Screen Sharing" app on your Mac. You won't find it in the Applications folder but if you enter "screen sharing" in the search box, then the app will come up.
Enter the IP (or the hostname) of your Raspberry Pi, enter your password and voilà!