Next we'll install Netatalk. We need version 3.0 or higher, which we'll build from source code. Open the Epiphany web browser from the left end of Raspbian's Task Bar and go to netatalk. sourceforge.net.
Under 'current releases' on the left, click the link to download the latest stable version (3.1.8 at the time of writing) in gzip format.
It will be saved to your Downloads folder, and the Xarchiver app will open to show you its contents. Right-click the file within and choose Extract (if right-clicking doesn't work with your mouse, select the file, then choose Action > Extract). Put it in your Downloads folder (it should already be chosen for you).
We need to install the packages listed at this website. If you're new to this, it's safest to install one at a time. For each of the required packages, type sudo apt-get --assume-yes install followed by a space, type the the name of a package, then press Return.
Enter cd /Downloads/netatalk-3.1.8
To configure Netatalk's installer, enter the following text – every double hyphen should be preceded by a space, and every line below that ends with a hyphen has no space after it.
./configure --with-init-style=debian-systemd --without-libevent --without-tdb--with-cracklib --enable-krbV-uam --withpam-confdir=/etc/pam.d --with-dbussysconf-dir=/etc/dbus-1/system.d --with-tracker-pkgconfig-version=1.0
You'll see a summary when this process completes. The next few commands each take a while to complete. Enter sudo make. When it's done, enter sudo make install to run the installer. When this finishes, verify Netatalk installed correctly by entering afpd -V.
All being well, the first line of the response will be 'afpd 3.1.8 - Apple Filing Protocol (AFP) daemon of Netatalk'.
To start the software, enter sudo service avahi-daemon start, followed by sudo service netatalk start. Neither command should return any output, but you should see 'raspberrypi' appear under Shared in Finder's sidebar on your Mac.
You'll want Netatalk to start at login. Enter sudo nano /.bashrc and add the same two commands you just ran on new lines at the end of the file. Press Ctrl+o and then press Return to save the file, then Ctrl+x to quit Nano.
Make the Raspberry Pi visible to Time Machine
Enter sudo nano /etc/nsswitch.conf and look for the line starting 'hosts: files mdns4_minimal'. Add a space to its end, then append mdns4 mdns. Save changes and quit nano. Now enter sudo nano /etc/avahi/services/afpd.service and enter the following. Where it says [Tab], don't type it but press the Tab key on your keyboard to indent the line.
[Tab] [Tab] _afpovertcp._tcp
[Tab] [Tab] 548
[Tab] [Tab] _device-info._tcp
[Tab] [Tab] 0
[Tab] [Tab] model=TimeCapsule
Save and quit, then enter sudo nano /usr/local/etc/afp.conf and under [Global] add mimic model = TimeCapsule6,106. Also, append this to the end of the file:
[Time Machine 3TB]
path = /media/time_machine
time machine = yes
Save and quit, then restart your Raspberry Pi. In Finder on your Mac, under Shared in the sidebar, connect to the Time Machine partition on the Raspberry Pi using pi and raspberry as the username and password, respectively. Finally, connect Time Machine to your Raspberry Pi.