Additional Check out how to view a Pi desktop on an iPad in this post.
I typically connect to my Raspberry Pis via SSH from my main machine, a Mac. This is fine for pretty much all of the tasks I perform on the Pis, but it only provides access to the commmand line. That’s not a problem for me, but I nonetheless wondered whether I might be able to access the Pi’s desktop UI remotely too.
It turns out that you can, using VNC (Virtual Network Computing). VNC is a standard, widely supported way of securely presenting a GUI remotely over a network connection. You need a suitable server running on the machine that will be sharing its desktop, and a client app to present that desktop on the computer you’re accessing the remote machine from. The client relays your mouse and keyboard input back to the remote computer.
The Raspberry Pi Foundation recommends a specific VNC server, tightvncserver, written by TightVNC Software. You can install in the usual way:
sudo apt-get install tightvncserver
When the software has downloaded and installed, it’s ready to run:
You will be asked to set up an remote access control password and to enter it a second time, as verification. You’ll also be asked if you’d like to enter a password for view-only access. This is optional; I just entered ‘n’ for no.
The server is now running and, if you set it up using SSH, you can log out of the Pi if you wish.
TightVNC doesn’t supply a client for Mac OS X, though it does offer a client for Windows and a cross-platform client that runs under Java. I’m not a fan of cross-platform tools — you tend to lose the benefits of your preferred OS — so I wondered if there was a native Mac OS X VNC client. There is and it comes free with your Mac, though you might never have seen it before.
Apple has long provided Apple Remote Desktop (ARD), a tool for remotely accessing Mac desktops. Over the years, it has gained support for a variety of remote access technologies, including VNC.
ARD doesn’t live in the Applications folder — it’s actually buried deep in the System folder — but it can be launched via finder: just hit Command-K to invoke the standard Mac ‘Connect to Server’ dialog. Here, enter
and click on ‘Connect’. The ‘vnc’ at the start sets the protocol you’ll use to connect to your remote Pi, which is identified here by its Bonjour (mDNS) name: its hostname (typically set using raspi-config followed by
.local). The number after the colon is the port through which the communication takes place. tightvncserver defaults to VNC port 1. 5900 is the base VNC port, hence 5901.
You’ll now be asked for the remote desktop’s access password. This is the password you set through tightvncserver, not your regular Pi password (they can be the same, of course, though it’s perhaps best to use different ones, for tighter security). You can choose to save the password in the keychain for faster access next time.
All going well, you’ll now see your Pi’s X desktop appear in a window provided by an ARD app called Screen Sharing. Depending on your Pi (the faster the better) and the quality of your network connection (ditto), the desktop is quite useable. You might not want to do all of your Pi work this way, but it’s acceptable for occasional use.
When you’re done, you can open shut down your Pi (using the Terminal or the Pi menu) or select ‘Close’ from Screen Sharing’s Connection menu.
By default tightvncserver establishes an 800 x 400 desktop, but you can change that using the -geometry switch. You can set the colour depth using the -depth switch too. For example:
tightvncserver -geometry 1920x1080 -depth 24
Of course, the bigger the desktop and the higher the colour depth, the more data that needs to be sent to Pi to Mac, and the slower and less responsive the remote system will feel. Experiment to find the size you prefer. I usually stick with the default. I also set my Pis to boot to the command line and not to auto log in, so they don’t run separate X sessions in the background.
Please make sure that Screen Sharing (in the Sharing section of System Preferences) is enabled on the computer to which you are attempting to connect. Also make sure your network connection is working properly.
^this is what its saying
Great help thank you.
Any way to get those four snapshots from Wm Cerniuk? The links are broken.
I have vnc working now . I use tightvncserver on the picture and Realvnc viewer on the Mac. I run up tightvncserver via ssh command and then use Realvnc viewer with the connection ‘raspberrypi.local:5901’
Cheers for all of the previous clues😀
Typo for picture read raspberrypi. Oops!
thanks for posting this. I just found this via google and it looks like raspbian now includes a VNC Server. So you can just enable this from raspi-config then download the (free for noncommercial use) client. Setup was super easy for me. I briefly tried Apple Remote Desktop but this didn’t work for me. Instructions here:
trying it on a pi zero w … the pi gives its name on net (arp -a) as raspberrypi.lan with ip 192.168.86.191. however none of the .lan .local or ip address work with ARD. I get Unable to resolve “192.168.86.191;5901” drat. as I’m trying to run the pi0w headless with a camera to do a wearable project. Will try some other things
Not sure if the info on Raspberry Pi foundation has changed from the time of writing, but they recommend RealVNC as of now.
Beautiful. This is SIGNIFICANTLY better than VNC Viewer (which is very good, mind you, but kinda proprietary and limited) when used on my home network. My Pi Zero W (the first of many) is now happily headless and no longer boots into a desktop, freeing up resources for other stuff. Thanks to you for showing the way!
Would not recommend this approach. Java is a very inefficient system and tightvncserver relies upon Java to run on the Pi. Since there is not much of a processor on the Pi, you have to be conscious of what you run.
Instead use the built-in RealVNC server and simply turn off the proprietary account system, switching it as:
Security > Authentication: VNC password
Security > Encryption: Prefer off
and set up 1 or more VNC users as shown in the snapshots..
https://www.evernote.com/l/AtllSyKCKZFOlLtiX3_Ca827bzOXd3MQBjo – menu item
https://www.evernote.com/l/AtkvUCagDbRFeKyx_D04LveXHYGtWfHJCXw – RealVNC Server Config menu
https://www.evernote.com/l/Atm5jIlipkNOiaav8fFNl-BR8o2M2B4SAic – RealVNC Server security settings
https://www.evernote.com/l/AtmCqEz4qaVI35XKqP4fShxwR8lDnnaZ-FQ – RealVNC Sever User Settings
And then you can use macOS’s native “Screen Sharing” **without** installing **anything** on your Mac. That is in fact how I captured those images linked above.
the tightvnc software is only for windows…. how do you open it with Mac?
On Mac it’s just to open the included app; press the keys cmd + space, search for “Screen Sharing.app” and then enter this address into the input field vnc://raspberrypi.local:5901
Awesome!!! Thank you!!
thanks for this!
I originally followed the directions on another site for VNCServer, and wow they need a license? blah. uninstalled.
and then found this info. worked perfectly!
Raspberry Pi 3
OS: Raspberry PIXEL Feb 2017
Why does my Mac loose the tightvncserver connection?
Once I loose it I have great difficulty getting back in, what am I doing wrong?
Please note that I am a beginner to all of the Raspberry Pi things.
In minibian I can remote VNC, however it doesn’t ‘share’ the root desktop user screen (i.e. gives me a new instance) any ideas how to solve this? X11 config mods or etc?? Great posting, thanks for sharing!
the default bonjour name is ‘raspberrypi’ so you need to put in “vnc://raspberrypi.local:5901” or “vnc://[ip address of pi]:5901”
the ip address is likely to be 192.168.1.xxx
Thanks bro. That worked
Thanks Smittytone for this great walkthrough and Thomas for the critical tweak to get things working for me.
Excellent! Thank you for posting…
i doesn’t work for me. when i try to connect with the macbook it says to me impossible solve “pi.local:5901”
check hostname on the raspberry pi, mine was ‘raspberrypi’ by default
On The rasbperry pi do a : hostname -I in the command window, that’s a – capitol I as in Internet. it will tell you your DHCP IP address. On the Mac Side, in terminal command window: open vnc://email@example.com:5901 Of course, use the IP address you got in the hostname -I on the raspberry pi.
I tried this and it worked the second time after setting up SSH – TY for posting 🙂