Introduction: Raspberry Pi Remote Desktop for Mac
This is a tutorial on how to setup tightvnc to access a Raspberry Pi's desktop using a Mac, when the Pi is running in headless mode.
1. SSH enabled Raspberry Pi
-This instrucable assumes that your Pi is already online running in headless mode, that is to say, connected to the network you intend to remotely access it through. There are many extant tutorials on how to do this, come back here when you successfully SSH into your Pi and are ready to set up remote desktop.
2. A Mac running Java
- The reason for this exercise. As the Remote Desktop Protocol that is the standard was developed by Microsoft, macs have no client for RDP connections installed by default. We will be rectifying this by installing an alternate client using a different protocol, tightvnc. Tightvnc relies on Java, so we will need it installed for our client to work.
Step 1: SSH Into Your Pi
Connect to your Pi to begin the process.
Step 2: Download Tightvnc Server Onto Your Pi
Enter the command
$ sudo apt-get install tightvncserver xrdp
Step 3: Run Tightvncserver
Enter the command
on the Pi to start the program. You will be prompted to enter a password. This will be used later to connect to your desktop. The password must be between 5 and 8 characters. Any additional characters you type will be truncated.
Note: This step must be performed via SSH every time the Pi is turned on in order to connect the client
Step 4: Download the Tightvnc Java Client on Your Mac
and download the latest java client
Step 5: Unzip and Open
Unpack the contents to the directory of your choice, and then attempt to open tightvnc-jviewer.jar. Most likely you will see the above error. If it opens, go ahead and skip to step 8.
Step 6: From System Preferences Open Security and Privacy
Open System Preferences and select Security and Privacy
Step 7: Grant Permissions
Navigate to the General tab, and look towards the bottom. There should be a notification about our .jar. Go ahead and select Open Anyway.
Step 8: Run Tightvnc Client to Connect
Run the .jar, and it will open this window. Enter the Pi's IP address in the Remote Host field, and change the port number to 5901. You are now ready to connect to your Pi.
Step 9: Enter Password
If everything went well in the previous step, you will be prompted to enter the password you created in step 3.
If this is not what you see, most likely either the IP address is wrong, or if you are returning to this tutorial after initial installation, you may have forgotten to run the server on the Pi via SSH first. Go ahead and verify that information is correct.
Step 10: Congratulations!
You are now viewing your Pi's desktop... remotely!
Step 11: A Note on Creating GUIs
Because of the nature of how the screen is created and displayed, you might run into permissions issues trying to run programs from the command line that will create a GUI. The easiest workaround for this is to simply preface these commands with 'gksudo'. This will prompt you for your sudoer password, and then create the GUI you are looking for.