Here are a sequence of commands that work. 1-4 can be thought of as "setup" commands and 5 can be repeated for the same volume. Recommend using "pi" as the username on the macOS (aka AFP) server to keep confusion down on file ownerships.
sudo apt-get install afpfs-ng -y
sudo apt-get install fuse -y
sudo mkdir -p /Volumes/volName
sudo chown pi:pi /Volumes/volName
afp_client mount -u pi -p piPasswordOnMacServer macServerIPAddress:volName /Volumes/volName
Then to unmount the volume you do a:
sudo umount /Volumes/volName
where:
volName
- is the name of the "share" or volume you want the pi to access on your AFP server
piPasswordOnMacServer
- the password setup for the "pi" user on the AFP / macOS server
Here is the same thing but getting more towards a script... The installs in #1 & #2 need not be repeated. The single command line for #3 can be used repeatedly with a different volName
in your macOS (AFP) server that you want to mount:
sudo apt-get install afpfs-ng -y
sudo apt-get install fuse -y
sudo mkdir -p /Volumes/volName;sudo chown pi:pi /Volumes/volName;afp_client mount -u pi -p piPasswordOnMacServer macServerIPAddress:volName /Volumes/volName
Moving more towards a shell script, change the macServerIPAddress
, volName
and piPasswordOnMacServer
to variables and feed them in as parameters to your shell script.
Very important, do not sudo
the afp_client
command or you can only access what you mount as root
, forcing you to sudo su
to use the mounted volume which has a bunch of negative side effects for use on the RBPi
Last note: you can cd /Volumes/
but you cannot then cd /volName/
as it will say no such file or directory. You need to cd /Volumes/volName/
for the illusion to work.