Table of Contents
Copying Files From Raspberry Pi To A Mac #
The simplest way is to use Secure CoPy from a Terminal Window (see also “Article on Using SSH On A Mac”).
Open a terminal window and use the following command:
scp pi@<IP Address of Raspberry Pi>:<Path to File> .
Using a “.” at the end copies it to your current directory (you can find this out by typing “pwd”)
An example of copying the Sleepy-Pi-Setup.sh from the “Pi” user’s home directory /home/pi to the current directory on the Mac.
scp firstname.lastname@example.org:Sleepy-Pi-Setup.sh . (note the dot on the end)
NOTE: This is done from the Mac Terminal window without being logged in to the Raspberry Pi over SSH. I am forever forgetting this and try doing it from an SSH session.
Copying Files From A Mac To A Raspberry Pi #
You can do this with the following syntax:
scp <Path to File To Copy> pi@<IP Address of Raspberry Pi>:<Path that File will Go>
An example of copying the Sleepy-Pi-Setup.sh to the “Pi” user’s home directory /home/pi from the current directory of the Mac:
Shared Drive #
There are a few ways to share your Raspberry Pi’s drive with a Mac. Popular ones are Samba and netatalk. If you are going to also use your Raspberry Pi with Windows machines then Samba may be the best choice. This note is going to describe netatalk which is a Mac protocol – the great thing is there’s nothing to install on the Mac, it’s all on the Raspberry Pi.
To install on the Raspberry Pi use the following incantation on the Raspberry Pi or an SSH link to the Raspberry Pi:
sudo apt-get install netatalk
and install netatalk. Before it’s of any use you need to configure it to tell it what to share:
sudo nano /etc/netatalk/afp.conf
The default file looks like this:
Note that everything is “commented out” with “;”, don’t miss this fact!
The only thing you need to do is edit the [Homes] section. It should go from:
; based regex = /xxxx
[Homes] (note no “;”)
basedir = /home (note no “;”)
Save the file with a CTRL + X then Y and Enter
Now you need to restart the service to load in the shares with:
sudo systemctl restart netatalk
That’s the configuration on the Raspberry Pi, now we can connect to it on the Mac. You can either do:
or if you know the IP Address or you have more than one Raspberry Pi on the network and you want to connect to a particular one.
This will ask you for a password – which is the password for the Raspberry Pi , not anything local on your Mac. So with defaults this will be: “pi” and “raspberry”.
Click “Connect” and this should connect and open up a Finder window with you Raspberry Pi /home directory.