Setting up VNC on Raspberry Pi for Mac access

I wanted to set up VNC on my Raspberry Pi so I could use it via a remote desktop on my MacBook Air. There are lots of instructions scattered in various places around the web, but now I’ve put together a comprehensive set of things to do, I thought it might be useful to share it in one place.

Set up file sharing and autodiscovery

[Source: Getting Started With Raspberry Pi]

On the Pi:

sudo apt-get install netatalk

Now from the Mac, open Finder, and hit ⌘K. Enter afp://192.168.0.22 (using the IP address of your Pi).

On the Pi:

sudo apt-get install avahi-daemon
sudo update-rc.d avahi-daemon defaults

Now create a file /etc/avahi/services/afpd.service (as root):

sudo vim /etc/avahi/services/afpd.service

and add this content:

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
   <name replace-wildcards="yes">%h</name>
   <service>
      <type>_afpovertcp._tcp</type>
      <port>548</port>
   </service>
</service-group>

Then run this command:

sudo /etc/init.d/avahi-daemon restart

You should now be able to see the Pi in the Finder sidebar.

Setting up vncserver

[Source: Raspberry Pi forum]

On the Pi:

sudo apt-get install tightvncserver
vncserver

Enter an eight character password.

Now do:

cd /etc/init.d
sudo vim tightvncserver

Add the following content to the file:

#!/bin/bash
# /etc/init.d/tightvncserver
#

# Carry out specific functions when asked to by the system
case "$1" in
start)
    su pi -c '/usr/bin/vncserver -geometry 1440x900'
    echo "Starting VNC server "
    ;;
stop)
    pkill vncserver
    echo "VNC Server has been stopped (didn't double check though)"
    ;;
*)
    echo "Usage: /etc/init.d/blah {start|stop}"
    exit 1
    ;;
esac

exit 0

(Change the geometry setting if your monitor is a different size.)

Now do:

sudo chmod +x tightvncserver
sudo pkill Xtightvnc

Check the VNC server is not running:

ps aux | grep vnc

Then do:

sudo /etc/init.d/tightvncserver start
cd /etc/init.d
sudo update-rc.d tightvncserver defaults

Finding your VNC server using Bonjour

[Source: Getting Started With Raspberry Pi]

Create the avahi rfb service file:

sudo vim /etc/avahi/services/rfb.service

and add this content:

<?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>5901</port>
  </service>
</service-group>

Then run:

sudo /etc/init.d/avahi-daemon restart

Now you should be able to see the Screen Share option for the Pi in your Finder sidebar.

If you’re also running an X session directly on the Pi (i.e. not through VNC), consider disabling the screensaver. You might forget that this X session is running if you’re not looking at the monitor (or if the monitor is turned off), and you’ll wonder what’s eating all the CPU suddenly after ten minutes. (Yes, this happened to me!)

UPDATE:

Tom A commented below with an improved version of the startup script. Rather than leave it hidden in the comments, I decided to bring it up into the article. I haven’t tested the script, but I present it here for information.

Hi Pat,
Thanks so much for pulling this together. It saved me a lot of time getting this to work. In the spirit of adding to the solution, I can provide the following: I’ve tested this and found it to work on OSX 10.5.8, 10.6.8, 10.7.5, and 10.8.3. And I bashed your startup script against Andrew Berry’s generalized one to come up with the following version that does not pester you when you update-rc.d or perform various apt functions. This fixes what Ray was was asking about back in June of last year.

#!/bin/bash
### BEGIN INIT INFO
# Provides: tightvncserver
# Required-Start: $remotefs $syslog
# Required-Stop: $remotefs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start VNC server at boot time
# Description: Start VNC Server at boot time
### END INIT INFO

# The Username:Group that will run VNC
export USER="pi"
#${RUNAS}

# The display that VNC will use
DISPLAY="1"

# Color depth (between 8 and 32)
DEPTH="16"

# The Desktop geometry to use.
#GEOMETRY="x"
#GEOMETRY="800x600"
#GEOMETRY="1440x900"
#GEOMETRY="1280x1024"
GEOMETRY="1920x1080"

# The name that the VNC Desktop will have.
NAME="my-vnc-server"

OPTIONS="-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"

. /lib/lsb/init-functions

case "$1" in
start)
log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
;;

stop)
log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
;;

restart)
$0 stop
$0 start
;;
esac

exit 0

UPDATE:

Dennis Tsang has written up some instructions which look like they provide a quicker way of getting all this done. I haven’t tried them myself, but if I get feedback suggesting that Dennis’s instructions are good, I’ll make the link more prominent on this page.

This entry was posted in Mac, Raspberry Pi. Bookmark the permalink.

91 Responses to Setting up VNC on Raspberry Pi for Mac access

  1. Ray Stuckey says:

    > cd /etc/init.d
    > sudo vim tightserver

    shouldn’t that be tightvncserver?

  2. Ray Stuckey says:

    I end up with what looks like an error:
    pi@raspberrypi:/etc/init.d$ sudo update-rc.d tightvncserver defaults
    update-rc.d: using dependency based boot sequencing
    insserv: warning: script ‘K01tightvncserver’ missing LSB tags and overrides
    insserv: warning: script ‘tightvncserver’ missing LSB tags and overrides

  3. Axel says:

    That last command should be
    >sudo /etc/init.d/avahi.deamon restart

    • Axel says:

      I mean
      >sudo /etc/init.d/avahi-daemon restart

      • Pat Galea says:

        Well spotted! I’ll fix it.

        (The original article has it wrong, but when I run the command myself I use tab completion, so I wouldn’t have noticed that it was wrong.)

        Thanks!

  4. Paul says:

    I keep getting an error when I click share screen in finder – “make sure that Screen Sharing is enabled on the computer to which you are attempting to connect”. I can access the folders within finder and it’s finding the RPi. Do you have any Idea why this may be happening?

    • Pat Galea says:

      The only thing I can think of is that the vncserver is not actually running on the Pi. Try doing “sudo /etc/init.d/tightvncserver start” again to see whether that helps.

    • Snos says:

      Check the value of your Pi’s VNC port. Is it 5901? 5900? That port number must match the /service-group/service/port node in your .service file:

      _rfb._tcp
      5900

  5. Phil Glau says:

    Awesome. Exactly what I was looking for.

    Got the same error as Ray Stuckey (but it still works)

    pi@raspberrypi /etc/init.d $ sudo update-rc.d tightvncserver defaults
    update-rc.d: using dependency based boot sequencing
    insserv: warning: script ‘tightvncserver’ missing LSB tags and overrides

    Also confirming typo at end should be:

    sudo /etc/init.d/avahi-daemon restart

  6. karansamel says:

    what version of OSX are you using as in 10.7, there is no Bonjour. Also i was able to install everything on my pi and was able to access it as a shared device on my mac, but couldn’t see any screen share option, even with it enabled in system preferences.

    • karansamel says:

      i was not able to figure out what was wrong but i was able to get Chicken of the VNC to work instead :P

    • Pat Galea says:

      I’m running 10.7.4.

    • bbuddy says:

      That is a 100% incorrect statement. OS X has had Bonjour since version 10.0 (may be 10.1). 10.7 has Bonjour. I don’t usually point out people’s errors but that is a ludicrous statement to make! Apple actively uses Bonjour for their own services, and has been for years and years.

  7. Christopher says:

    Hi Pat,

    Thanks for this, really clear instructions.
    I am still a bit stuck, I can get the PI to be on the left in the finder and I can browse it, but can seem to get the VNC bit to work. The installs all seem to go fine?
    Any suggestions?

    Thanks,

    Christopher

  8. Chase says:

    Thanks a lot! Everything working perfectly. No longer need a USB mouse or keyboard and sitting on the floor… I can run it all from my laptop.

  9. James says:

    Hi Pat,

    Thanks for these instructions – so much clearer than the other forums I’d found first. I wish I’d come straight here and saved myself some time!

    What I would like to achieve is to play a video on my TV from the Pi and control it from my laptop. How should I go about this?

    Thanks,

    James

  10. James says:

    Pat,

    Please ignore last I’ve got it to work.

    Thanks,

    James

  11. Keith says:

    Brillant instructions, worked first time. Many thanks indeed.

  12. mike says:

    Brilliant many thanks. Still don’t like vi – and vim was not on the wheezy pi I used. Had to execute “sudo /etc/init.d/tightvncserver start” to wake up the link. Great to get shot of the second keyboard – always typing on the wrong one…

    Mike

  13. Jaxx says:

    Pat,

    Thanks for this, really clear instructions. I am also a little stuck, I can get the PI to be on the left in the finder and I can browse it, but not sharing screens. Ive ran the “sudo /etc/init.d/tightvncserver start” but it didn’t fix the problem.
    Any suggestions?

    /Users/hausofwalker/Desktop/Screen Shot 2012-12-06 at 20.08.32.png

    • Pat Galea says:

      I don’t have any brilliant ideas. Maybe just run through the process again to ensure there aren’t any typos in the files, or something like that. Or maybe there’s a firewall problem on your Mac that’s blocking it, but that’s unlikely unless you’ve specifically gone in there to block it.

      • Stephen says:

        I had a similar problem and I fixed it by connecting to the pi using the specific port the VNC server was directing to. The log file of the vncserver instance in question will mention a TCP port it’s directing to. For instance, I type

        $ sudo /etc/init.d/tightvncserver start

        New ‘X’ desktop is raspberrypi:1

        Starting applications specified in /home/pi/.vnc/xstartup
        Log file is /home/pi/.vnc/raspberrypi:1.log

        Starting VNC server

        $ less /home/pi/.vnc/raspberrypi:1.log

        05/02/13 23:48:45 Xvnc version TightVNC-1.3.9
        05/02/13 23:48:45 Copyright (C) 2000-2007 TightVNC Group
        05/02/13 23:48:45 Copyright (C) 1999 AT&T Laboratories Cambridge
        05/02/13 23:48:45 All Rights Reserved.
        05/02/13 23:48:45 See http://www.tightvnc.com/ for information on TightVNC
        05/02/13 23:48:45 Desktop name ‘X’ (raspberrypi:1)
        05/02/13 23:48:45 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t
        05/02/13 23:48:45 Listening for VNC connections on TCP port 5901
        Font directory ‘/usr/share/fonts/X11/75dpi/’ not found – ignoring
        Font directory ‘/usr/share/fonts/X11/100dpi/’ not found – ignoring
        xrdb: No such file or directory
        xrdb: can’t open file ‘/home/pi/.Xresources’

        So the target TCP port is 5901. Then, to connect using my macbook (running OS X 10.6), I open finder, hit Apple-K, and type vnc://134.173.xx.xxx:5901

        where the x’s are the actual IP address of my pi. Then I enter the password I set, ignore the warning message, and get my Pi’s screen!

        Hope this helps!

  14. Steve Ellis says:

    Good grief…. that was a marathon…. but it works…. absolutely brilliant… and I am a novice at Linux and Mac. The only parts that didn’t work were the VIM commands so I used File Manager and created the files that way…. Thank you for the time you must have put into this….

  15. ZeDctr says:

    Thank you for this great guide. I copy-and-pasted till the end … and it worked! Yes, i am quite new to the Unix-command line (after i switched to osx several years ago, even my little dos-skills almost vanished). Biggest hurdle was vim, used nano instead.
    Btw, is VNC for X only or can i somehow view the command line too? I have some applications, that need X not to run.

  16. Spencer says:

    Great stuff, good instructions and made me learn vim at the same time with vim tutor.

  17. tceleven says:

    Thanks for the instructions, they are great. Could you help with an error I’m getting when I start the screen sharing?

    When I start screen sharing nn error pops up saying “error: Xsession: unable to start X session..no home/pi/.xsession file. No session manager, no window managers, and no terminal emulators found.” . I an left with only grey screen.

    Thoughts?

    Thanks

  18. Brian Krogh Jensen says:

    Excellent guide!!

  19. Thorsten says:

    Thanks a million! That saved me a lot of time. Excellent guide.

  20. newpi says:

    sudo apt-get install avahi-daemon
    This installs 2GB of files, which will result in over 8GB once everything is built
    You should warn uses of this before starting. You could not do this on an SD card smaller than 16GB

  21. Thanks so much for posting this. Amazing instructions. Worked the first time!

  22. toffifee says:

    Thanks for the awesome post!
    Did you manage to configure the keyboard layout correctly? Special characters like \ [ ] etc don’t work for me.

  23. gerrycurry says:

    I just set this up and everything works perfectly with 10.8.3, EXCEPT, I need to manually restart VNC every time I restart my pi. Is there a way to have VNC automatically start on boot?

    • Pat Galea says:

      That’s strange. Did you create the /etc/init.d/tightvncserver script? That’s the one that makes it start up after booting.

  24. Tom A says:

    Hi Pat,
    Thanks so much for pulling this together. It saved me a lot of time getting this to work. In the spirit of adding to the solution, I can provide the following: I’ve tested this and found it to work on OSX 10.5.8, 10.6.8, 10.7.5, and 10.8.3. And I bashed your startup script against Andrew Berry’s generalized one to come up with the following version that does not pester you when you update-rc.d or perform various apt functions. This fixes what Ray was was asking about back in June of last year.

    #!/bin/bash
    ### BEGIN INIT INFO
    # Provides: tightvncserver
    # Required-Start: $remotefs $syslog
    # Required-Stop: $remotefs $syslog
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: Start VNC server at boot time
    # Description: Start VNC Server at boot time
    ### END INIT INFO

    # The Username:Group that will run VNC
    export USER=”pi”
    #${RUNAS}

    # The display that VNC will use
    DISPLAY=”1″

    # Color depth (between 8 and 32)
    DEPTH=”16″

    # The Desktop geometry to use.
    #GEOMETRY=”x”
    #GEOMETRY=”800×600″
    #GEOMETRY=”1440×900″
    #GEOMETRY=”1280×1024″
    GEOMETRY=”1920×1080″

    # The name that the VNC Desktop will have.
    NAME=”my-vnc-server”

    OPTIONS=”-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}”

    . /lib/lsb/init-functions

    case “$1″ in
    start)
    log_action_begin_msg “Starting vncserver for user ‘${USER}’ on localhost:${DISPLAY}”
    su ${USER} -c “/usr/bin/vncserver ${OPTIONS}”
    ;;

    stop)
    log_action_begin_msg “Stoping vncserver for user ‘${USER}’ on localhost:${DISPLAY}”
    su ${USER} -c “/usr/bin/vncserver -kill :${DISPLAY}”
    ;;

    restart)
    $0 stop
    $0 start
    ;;
    esac

    exit 0

    • Awesome script, thanks for posting. When I paste it into VIM and run it I get an error – it looks to me that the double and single quotes are formatted incorrectly as curved quotes rather than straight ASCII quotes (presumably due to WordPress auto-formatting of this post). I did a bunch of string substitution in VIM to fix that (e.g. :%s/“/”/g) and then the script seems to work!

      Unfortunately now I’m getting errors that all of the resolutions are invalid (e.g. “Starting vncserver for user ‘pi’ on localhost:1…vncserver: geometry 800×600 is invalid”).

      • Update: thanks to simple-simon’s post below I was able to fix the resolution error by replacing the unicode “x” in the resolution with a new “x” straight from the terminal window.

      • Pat Galea says:

        I think I’ve now fixed all the unicode problems in the copy I’ve posted in the article. Let me know if I’ve missed anything.

      • vstinebaker says:

        I copied/pasted the startup script included in the comments today (January 14, 2014) and I got the geometry is invalid problem. I manually edited the script replacing the character between the width and height values with the letter “x” and the script works fine. Seems like some Unicode might still be embedded in the script included in the comments.

      • Pat Galea says:

        Thanks! I think I’ve fixed those now.

  25. Dominus says:

    Two things I noticed that might be of help
    1. When I copy/pasted the vim entries from here to my terminal (OS X) window stuff at the beginning got cut. So before I realized it all the xml were invalid and so was the tightvncserver file. Very annoying.

    2. If you want to make it work with Apple Remote Desktop you will need to enter username pi and the password you gave when first running vncserver.
    BUT it will fail to verify. Choose to add anyway and then edit the settings for this connection in Apple Remote Desktop and set the port to 5901 (or 590x with x for the tightvnc session you want to view – typically 1) see http://gettingstartedwithraspberrypi.tumblr.com/post/24142374137/setting-up-a-vnc-server.

  26. samuelmoss92 says:

    Hi thanks for the help.

    when i enter the code below it shows the following errors.

    pi@raspberrypi ~ $ sudo /etc/init.d/tightvncserver start
    /etc/init.d/tightvncserver: line 4: $’\302\240′: command not found
    /etc/init.d/tightvncserver: line 8: $’\302\240\302\240\302\240\302\240su’: command not found
    /etc/init.d/tightvncserver: line 9: $’\302\240\302\240\302\240\302\240echo’: command not found
    /etc/init.d/tightvncserver: line 10: $’\302\240\302\240\302\240\302\240′: command not found
    /etc/init.d/tightvncserver: line 20: $’\302\240′: command not found
    I’ve followed everything to the dot and i even have the screen sharing option but it asks me to activate it on the pi end.

    Any help is appreciated.

    • Pat Galea says:

      \302\240 represents a Unicode non-breaking space. You shouldn’t have those in your file! I’m not sure how you got them.

      If you copy the script from this page and paste it into your text editor, you shouldn’t get any Unicode spaces.

      • MikeJ says:

        I had the same result, copy pasted into Leafpad from Midori. Blank lines get a single space.

  27. Andreas Kopp says:

    Imstead of this –> sudo vim /etc/avahi/services/afpd.service for me it worked this –> sudo vi /etc/avahi/services/afpd.service

  28. Lukas Blakk says:

    Thanks for this awesome walk-through. Some notes from my experience (10.8.3):
    * Was able to see/connect to my pi in the finder sidebar right after installing netatalk without the afpd service
    * don’t change the name of the vnc server to “remote window” — I don’t know if it’s because of the lack of hyphen or the choice of words but once I rebooted with that name I got a very different screen over vnc and also a “GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: An authentication agent already exists for the given subject” and once I changed it back to a word-word title, all was well again.

  29. Peshawa says:

    Thank you for this clear walk through.

    It worked at first, but when I upgraded the raspberry pi using (sudo apt-get upgrade), the screen sharing bit no longer works. any suggestion of how to fix it? Thanks

  30. Tim F says:

    Q: Can you run this in reverse, that is to say control a Mac from Raspbian using VNC?

  31. simple-simon says:

    Great post, solved the problem of running my PI headless and accessing from my mac in different locations. I had some issues being a NOOB, I hacked about until everything started and stopped OK

    First problem was the stop parameter on the original script didn’t seem to work. I therefore went for the full script further in the post.
    Mistake 1: copy and paste from a web page. I got an error on line 32. The one that sets the options. This is fixed by retyping the x in the geometry line.
    Mistake 2: To fix the above I messed around with quotes as they looked like backticks instead of quotes. Not sure whether that makes a difference but the subsequent points might make sense.
    DOH 1: forgot the start or stop params for quite a while!
    Final changes I found the issue out by adding -x to the end of line one, which gave me some output. Basically ${DISPLAY} wasn’t appearing as 1 on the stop su line and ${OPTIONS} were being passed on the start SU line. Despite googling about quotes I still don’t understand if there is a difference between single quotes and double quotes. What is working right now (no idea why) is
    for start …..
    su ${USER} -c “/usr/bin/vncserver ${OPTIONS}” – where single quotes didn’t
    and for stop ….
    su ${USER} -c ‘/usr/bin/vncserver -kill :’${DISPLAY}

    Two different approaches no idea why they work differently, I suspect double quote would work with the quote at the end of the line instead of single quote before the var, but as with my mistake I had mixed quote approach from both scripts.

    Very grateful for the overall solution it’s really slick, now if I could only get wireless auto starting with multiple SSIDs……..

    • Andrew Hayes says:

      I have encountered a similar issue with this line.

      when i leave it as:
      su ${USER} -c “/usr/bin/vncserver ${OPTIONS}”
      I get an error saying my geometry is invalid

      when I use: (single quotes)
      su ${USER} -c ‘/usr/bin/vncserver ${OPTIONS}’

      the error goes away and everything acts as expected.

      the stop line works with double quotes

    • Andrew Hayes says:

      another update.

      so my last comment works but after rebooting, the resolution was not kept. so the screen sharing would work but it was not using the resolution i provided. I am new to this stuff so i dont know why. in the end below is what worked for me. I hard coded my resolution in and kept double quotes.

      Any input as to how fix this would be awesome!:

      OPTIONS=”-name ${NAME} -depth ${DEPTH} -geometry 1366×768 :${DISPLAY}”

      . /lib/lsb/init-functions

      case “$1″ in
      start)
      log_action_begin_msg “Starting vncserver for user ‘${USER}’ on localhost:${DISPLAY}”
      su ${USER} -c “/usr/bin/vncserver ${OPTIONS}”
      ;;

      stop)
      log_action_begin_msg “Stoping vncserver for user ‘${USER}’ on localhost:${DISPLAY}”
      su ${USER} -c “/usr/bin/vncserver -kill :${DISPLAY}”
      ;;

  32. Church says:

    Thanks for this. Your script worked fine, but I couldn’t get Tom’s to work. That may be because of all the unicode in his. Most of that was easy enough to spot, but I might have missed something.

  33. Alex Eamonson says:

    Is there a way of getting this to mirror what is displayed on my HDMI output on the pi rather than it as a new x session?

    I’m was rather hoping that I could get it to mirror.

    Apologies if I missed the answer to this when reading the above comments, last night was long!

  34. mysterries says:

    Thanks for this!
    Shouldn’t the first Mac terminal command be Shift+Cmd+K (New Remote Connection)?
    Thanks again.

  35. Ted R. says:

    Your instructions were very easy to follow and I was quickly able to remotely access my RPi in the Finder. Is there a way to modify so that I can get to the root level of my RPi’s file system with Finder? Currently, Finder displays pi’s home directory (that is, /user/pi) and its subdirectories. Thanks!

  36. Chip says:

    No matter what I try (cut/paste, type from scratch), when I try to start/stop/restart using the tightvncserver script it acts like I’ve got an error in the options (gives me the help file). I’m going bonkers trying to see what is wrong. I’ve line-by-lined this and it all looks OK.

    -C

    • Chip says:

      Ok, that was a stupid error. I was in the /etc/init.d/ directory and was trying to start by using “tightvncserver” commands. Worked when I used “./tightvncserver”. Dumb, dumb dumb. Got it now.

      But now the question is … can I connect to an active X session? I’d have a desktop running all the time, but I’d like to remote in and take charge of the screen. I do this on the Mac all the time for my iMac. But this only brings me a new session when I do it with the rpi.

  37. msodrew says:

    Quick, to the point, and worked on the first try for me.

    Dope post dude.

  38. Matt says:

    When I enter “sudo vim /etc/avahi/services/afpd.service” into the terminal it just says “sudo: vim: command not found”. I am new at this so I am not sure if you are speaking in very general terms of creating a file, but could you explain. I tried creating a blank file but got an error “Error opening file ‘/home/pi/ect/avahi/services/afpd.service’: No such file or directory”.

  39. Hey Pat,
    Thanks so much for this post. I am a RPi newbie. I was looking for something like this for weeks.

  40. NelsonB says:

    Very nice, thank very much!
    With me, X11 forwarding via ssh stop working after this (X11 connection rejected because of wrong authentication.) but solution is at

    http://www.querzone.de/wiki/Wiki.jsp?page=Raspberry

    or at

    http://raspberrypi.stackexchange.com/questions/1719/x11-connection-rejected-because-of-wrong-authentication

    Hope it helps someone.

  41. nvpb says:

    Nice! Thank you very much!
    After “setting-up-vnc-on-raspberry-pi-for-mac-access” , X11 forwarding via ssh (-X or -Y) stop working, complaint of “X11 connection rejected because of wrong authentication” …
    In case it happened not only to me, here is a solution that worked for me:

    http://raspberrypi.stackexchange.com/questions/1719/x11-connection-rejected-because-of-wrong-authentication

    or, even more detailed at :

    http://www.querzone.de/wiki/Wiki.jsp?page=Raspberry

    (maybe necessary to restart no ssh session or even reboot… )
    Just in case…

  42. William Rose says:

    This is the error I get.

    pi@raspberrypi ~ $ sudo update-rc.d avahi-daemon defaults
    update-rc.d: using dependency based boot sequencing
    insserv: warning: script ‘mathkernel’ missing LSB tags and overrides
    pi@raspberrypi ~ $ sudo vim /etc/avahi/services/afpd.service
    sudo: vim: command not found
    pi@raspberrypi ~ $

  43. Juan Rubio says:

    it is working just fine , thanks guys .

  44. Bob Hewitt says:

    Got the file sharing working. By changing the x in the display options got the vnc server working without errors (as a previous commentator noted).
    All the time I’m getting authentication errors. After clicking on “Share Screen..” and entering my password I get:
    Connection failed to “raspberrypi”.
    The software on the remote computer appears to be incompatible with this version of Screen Sharing.
    I’m running OSX 10.9.1
    I had all this running a while ago (albeit manually stating the vnc server and without file sharing) but since updating OSX the screen sharing bit has stopped working. Any help gratefully received.

    • Bob Hewitt says:

      OK, got it working. I had to start it manually with “vncserver :0 -geometry 1920×1080 -depth 24″. It then asks you for a vnc password. Max 8 characters. shut down the restart (so that the server starts on it’s own).
      If you’re still having problems goto your home folder and into the VNC folder. Delete the “passwd” file. Start the server manually. Restart and bingo – it worked for me (hooray).

  45. MikeJ says:

    I’m trying to edit something in leafpad (sudo leafpad *) over VNC, but I get an error “client is not authorized to connect to serverLeafpad”

    Is there a permission step I missed?

  46. Robbo says:

    Thumbs up.
    Worked like a charm! Thanks heaps.

    Robbo

  47. pino says:

    http://dennistt.net/2013/09/15/raspberry-pi/

    here only 2 step…and voilà!!!!

  48. Rafah says:

    I found my pi on the finder’s sidebar even before I install avahi. What is avahi for then ?
    + I also don’t have the screen sharing option :/

  49. Ram says:

    Awesome help!! I wasted last night and unable to get this working.. but, your article helped a lot in getting it up and running in a few minutes.. hats off!

  50. Hey all, anyone have advice on how I can use this to control an RPi already hooked up to an HDMI display? It seems that this spawns a new x session to be used instead of controlling they existing one, and I can’t find any documentation to assist. Thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s