If you’re working on a Raspberry Pi project using a Mac, then you probably want to copy files between the Mac and the Pi. By setting up the netatalk software on your Pi, then opening a new terminal window on your Mac and using the open afp://hostname.local command to connect your Mac to your Pi, your Pi will then appear as a mounted volume on your Mac, almost like it’s a USB drive. The Steps below describe how to set this up. Once netatalk is installed, then you’ll just need to use open afp:// each time you want to connect your Mac to a powered-up and running Pi.
Turn on and log into your Raspberry Pi
- Launch the Terminal program on your Mac by pressing Command-Space to launch Spotlight, then type Terminal, and press the return key.
- Log into your Pi using the command below replacing hostname with your Pi’s hostname, then press the return key.
- Enter your Pi’s password, followed by the return key.
Install the nettalk software on your Raspberry Pi, which will allow your Pi to appear on your Mac as a folder available on your network.
- From the terminal prompt enter the command below, then press the return key:
sudo apt-get install netatalk
press [y] if asked if you can use disk space
Open a second window in the Terminal program. This time you’ll be at your Mac’s terminal prompt.
- From within Terminal program, select the “Shell” menu, then New Window > New Window with Profile – Basic (or type Command-N).
A new Terminal window will open.
- From this prompt, type the command to open a connection from your Mac to the Raspberry Pi by using the command:
open afp://<your pi’s hostname>.local
for example, the Raspberry Pi that I used for the “Make It Talk” project had the hostname “talkpi”, so I typed the command:
This should present you with a dialog box stating “You are attempting to connect to the server “<your pi’s hostname>.local”.
- Click the “Connect” button co continue.
Only if this doesn’t work, you can also try removing “.local” from the command above. You can also try including your Pi’s IP address instead of “<your pi’s hostname>.local”. For info on finding your Raspberry Pi’s address see Adafruit’s tutorial.
- In the dialog box, enter “pi” as the username, and enter your Raspberry Pi’s password in password, then select the “Connect” button.
- Open a Finder window on your Mac.
- On the left-hand side of the Finder window, you should be able to scroll down to the “Locations” section and see the name of your Raspberry Pi. Select your Raspberry Pi’s name to connect to it.
That’s it! Your Raspberry Pi is ready to act like a remote drive attached to your Mac. Use the Mac’s Finder to copy, move, rename, delete, and launch files.