Saturday, December 13, 2014

Access Raspberry Pi via SSH, VNC and netatalk from your Mac

Originally I planned to use a Mac for my work with opencv on the Raspberry Pi. I failed to set up the Mac properly so I switched to my Ubuntu Laptop which was laying around. And it was so much easier. Mostly because of the various tutorials available. Recently I hadn't any time to play around with opencv but maybe I find some time now and then. And since where I live now, I don't have my Linux PC with me, I have to do it with my MacBook Air.

The first thing if you want to work with a Raspberry Pi and don't have a Monitor available, you want to link it somehow to your PC/Mac and do the work from there. I explained how I did it with my Ubuntu Laptop here and now I want the same functionality with my MacBook.

So first I want to find out the IP address of the Raspberry Pi. I looked in the AppStore and found a free app called "IP Scanner" (Link), which shows all the IP addresses of all the devices in your network.

Connecting over SSH

To connect to your RPi open the terminal on your Mac and type this with the IP adress of your RPi:
 ssh pi@192.168.0.101  
Type in your password (default: raspberry).

Finally in your terminal you should see:
Now every command you type here, the RPi executes - not your computer.

Connecting over VNC

Sometimes this is not enough and you want to see the GUI of the RPi. You can also do this over the network with a VNC server. The part on the RPi is the same and I just copy it from my former tutorial.

On your RPi:
First connect to your RPi over SSH and install tightVNC.
 sudo apt-get update  
 sudo apt-get upgrade  
 sudo apt-get install tightvncserver  
To start the VNC Server use this command:
 vncserver :1 -geometry 1024x600 -depth 16 -pixelformat rgb565  
You must specify a password (8 characters) that you need to connect later. Answer no to the view only question.

On your Mac:
On the Mac you don't need to install anything. Sure, you could install any VNC Viewer you like, but if my computer already comes with the tools, I like to use them.
In Finder press
 cmd+K  
A new window opens where you can type in the IP of your RPi (don't forget to edit the command!):
 vnc://192.168.0.101:5901  

The 01 at the end it the VNC server on the RPi, to start the server on the Pi we chose 1 as well. After that type in your password and hit connect.

After that 'Screen Sharing' should open and you see this:

This is very comfortable like this and you can even save your password and your IP.

File transfers with Netatalk

To transfer files I use Netatalk which is already installed on my Pi. I just paste the command from my older tutorial. Here we have to do it again only on the RPi.

On your RPi install netatalk:
 sudo apt-get install netatalk  
After that give it some time to fully boot and then you should see the RPi in your finder under shared:

Here you click on 'Connect As ...'. In the window that will open type in 'pi' as Name and your password from natatalk (default raspberry).


After that I have the full functionality as I had in Linux.

Program versions:
Mac OSX 10.10.1
Raspian wheezy

No comments:

Post a Comment