pteeson
Posts: 16
Joined: Thu Jul 02, 2015 12:08 am
Location: canada

RPi 3B+ not appearing in macOS Finder

Sat May 08, 2021 2:23 am

Trying to get the RPI3B+ to show up in the Mac Finder/Device and Network list.
Because I changed the name of the Pi to Not2B I followed directions in the "going headless with Avahi..." post.

On Mac it shows up in arp -a: not2b (192.168.1.20) xx:yy:zzetc on en0 ifscope [ethernet]
And on the Pi avahi-browse - a shows it for eth0 and wlan.

I can ping it from the Mac and also ssh into it.

But what I want is to have it show up in the Mac Finder in the Networkand named devicesections rhe way my wife's Mac does and the iPad does.

Suggestions on what to do next?

TIA

epoch1970
Posts: 6505
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: RPi 3B+ not appearing in macOS Finder

Sat May 08, 2021 9:53 am

How old were these directions?
On raspios you don't have anything to do but change the hostname and reboot. Make sure the hostname is unique on the network.

By default the Pi (Linux indeed) doesn't publish much services that the Mac cares to use. Install samba or netatalk (file sharing) on the Pi and that might change. Or see how to create a custom service record with avahi.
In the meantime, you can install the "Discovery" app (ex-"Bonjour Browser") on the Mac. You'll see your Pi listed under the "_workstation._tcp." service.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

pteeson
Posts: 16
Joined: Thu Jul 02, 2015 12:08 am
Location: canada

Re: RPi 3B+ not appearing in macOS Finder

Sat May 08, 2021 11:53 pm

Thanks for the reply. I hadalready installed Bonjour Browser on the Mac and confirmed that workstation tcp service was discovered.

FWIW there are 2 Macs on my Lan and I discovered 2 things: (1) If the iMac goes to sleep both the Network and the iMac server disaper from the Finder left hand column Locations section. Waking the iMac makes them re-appear. (2) If the iMac is awake and I uncheck Sharing/Files they also disapper.

Live and learn! I will read up on avahi and setting up services. New stuff to me - great! Always happy to learn.

MiscBits
Posts: 249
Joined: Wed Jan 27, 2021 12:48 pm

Re: RPi 3B+ not appearing in macOS Finder

Sun May 09, 2021 1:09 am

No need for Bonjour browser - Macs have this built in to Finder unless you are after checking for a specific service.

If you are looking for a very simple file share then the simplest way is to use NETATALK. This runs on the Raspberry Pi OS very well and only takes a few minutes to set up:

Code: Select all

sudo apt update
sudo apt install netatalk
Once this is complete, you need to set the folders you want to share up in /etc/netatalk/afp.conf

I use the nano editor (sudo nano /etc/netatalk/afp.conf) and set the file to read:

Code: Select all

;
; Netatalk 3.x configuration file
;

[Global]
; Global server settings

[Homes]
  basedir regex = /home

; [My AFP Volume]
; path = /path/to/volume

; [My Time Machine Volume]
; path = /path/to/backup
; time machine = yes
This lets the Mac access any users home directories on the Pi once netatalk is restarted (sudo systemctl restart netatalk) subject to security restrictions.

Finder will now show the Pi and double clicking it will start the connect. Just select 'connect as', use the Pi user and password, save to keychain and you are away.

There are a few things you should be aware of though:

Netatalk uses the AFP protocol - this is being phased out by Apple and its worth looking into Samba long term
iPads will not be able to use this share in Files (it does not accept AFP shares)
You cannot share Mac drives / folders to the Pi without using SAMBA if you are up to date on the Mac. A recent update to 10.15 (Catalina) seems to have broken AFP shares and afpfs-ng will not find them).

The Pi may show up as a question mark in Finder (depends on your OS version on the Mac). This is not a bug but a fact that the icon used by the broadcast service is not mapped on the Mac to anything.

If this bugs you (and it does me after 2 seconds) then you have to create a file (sudo nano /etc/avahi/services/afpd.service ) with the following in it:

Code: Select all

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=RackMac</txt-record>
</service>
</service-group>
Then reboot the Pi (you can try restarting the avahi-daemon service BUT I find it works better to reboot) and after a moment or two reopen Finder and the Pi now looks like the old Mac servers!

TimeMachine backups work fine BUT always use an Ext formatted drive as user space file systems (AFS / NTFS etc) are very slow and error prone over LAN connections (more a general Linux issue than Pi / Mac).

To read / write the Ext disks directly on the Pi buy the Paragon Mac tools (here) they simplify life lots. The only thing they do not do well is change partition structure on disks (DiskUtil integration is basic) - I've found gparted on the Pi GUI better for my needs.
Is a computer language with goto's totally Wirth-less?

epoch1970
Posts: 6505
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: RPi 3B+ not appearing in macOS Finder

Sun May 09, 2021 8:14 am

MiscBits wrote:
Sun May 09, 2021 1:09 am
If this bugs you (and it does me after 2 seconds) then you have to create a file (sudo nano /etc/avahi/services/afpd.service ) with the following in it:

Code: Select all

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=RackMac</txt-record>
</service>
</service-group>
Or use the “mimic-model” option in afpd.conf
http://netatalk.sourceforge.net/3.0/htm ... onf.5.html
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

drtechno
Posts: 242
Joined: Fri Apr 09, 2021 6:33 pm

Re: RPi 3B+ not appearing in macOS Finder

Sun May 09, 2021 10:16 am

NFS is the standard network system that is usually set up on multi platform networks. Instead of bonjour or AFP if you want direct connections. Otherwise, Samba should work as well, I will list both ways:

NFS setup and method:

To install NFS on debian style systems:

Code: Select all

sudo apt update
sudo apt install nfs-kernel-server
Then check to see if it is running:

Code: Select all

sudo systemctl status nfs-server
Then make a share folder on a path on a permanently mounted drive. in this example, I'm going to share /dev/md0 which is a raid set mounted as the path /mnt/whiteTower In fstab. Then grant access to everyone on the system.

Code: Select all

sudo mkdir /mnt/whiteTower/my_shares
sudo chown nobody:nogroup  /mnt/whiteTower/my_shares
sudo chmod -R 777  /mnt/whiteTower/my_shares
Now we need to make our client list. I'm going to grant everyone on my network access. You can set clients individually if you want to, but your network must be changed to a static ip network because clients are recognized by their ip address instead of a netbios name. So in this example, I am going to assign the whole subnet (192.168.2.1-255) access because I want to keep the dhcp networking I have set up in my router. In my router, I reserved my server's ip address on the network so its ip address don't change in case of power failure, in this example, that ip address is 192.168.2.11.

So I add my subnet to client list, by editing the exports file:

Code: Select all

sudo nano /etc/exports
then add my line:

Code: Select all

 /mnt/whiteTower/my_shares 192.168.2.0/24(rw,sync,no_subtree_check)
Then save, and exit nano.
Then once my share configuration is configured, I initiate this new network mount point:

Code: Select all

sudo exportfs -a
since I run a firewall on the server, (ufw) I tell it to allow NFS traffic, then reload the rules list, then check my firewall rule I added:

Code: Select all

 sudo ufw allow from 192.168.2.0/24 to any port nfs
  sudo ufw reload
    sudo ufw status  
Then for mac users:
NFS is turned off normally on some installations, to start it, go open a terminal window, then type:

Code: Select all

sudo nfsd start
Then on the mac desktop: FInder Menu -> Go -> Connect to Server (or Command + K)
Next, you enter the ip of the server (192.168.2.11) and share path, telling it to use NFS protocal:
nfs://192.168.2.11/mnt/whiteTower/my_shares
and click the connect button.

Linux clients, normally assign NFS a mount folder, I named it NAS1 in this example:

Code: Select all

sudo mkdir -p /mnt/NAS1
sudo mount nfs://192.168.2.11/mnt/whiteTower/my_shares /mnt/NAS1
macOS can do the same as above in a terminal window if they need to mount this share permanently on a machine. There should be plenty of guides out there because this is the common method macOS communicates with Linux. Of course, this is the way to directly mount the drives instead of using a client control system like samba.

SAMBA method:

For a server already running samba
You would add your mac username to samba's client list:
on the linux server running samba, in a terminal window:

Code: Select all

smbpasswd -a USERNAME
Then it will ask for a password to set so the macuser will have to enter to log in, and re-enter it to verified that password.
Then on the mac machine, Menu -> Go -> Connect to Server (or Command + K)
smb://192.168.2.11
then select the samba share folder from the pull down list of shared samba folders (if multiple share) Then hit OK.
Then it will ask you for the username and password you entered on the linux server that was set up with the smbpasswd command.
Last edited by drtechno on Sun May 09, 2021 10:45 am, edited 1 time in total.

epoch1970
Posts: 6505
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: RPi 3B+ not appearing in macOS Finder

Sun May 09, 2021 10:44 am

drtechno wrote:
Sun May 09, 2021 10:16 am
macOS can do the same as above in a terminal window if they need to mount this share permanently on a machine. There should be plenty of guides out there because this is the common method macOS communicates with Linux.
Is it really? In my experience mounting NFS from OSX is fiddly compared to using netatalk.
This is the kind of stuff I have in /etc/fstab (it still exists) on my desktop Mac:

Code: Select all

ServerName:/FolderName - url net,vers=3,automounted,url==nfs://servername.domain:/mnt/some/export 0 0
It makes a "ServerName/FolderName" tree appear under "Network>Servers" in the Finder. This is automounted as the OS and especially Finder don't cope well at all with NFS targets disappearing, e.g. when switching location in network preferences.
Amazingly, settings for the automounter (at least until 10.13) are in /etc/autofs.conf in OSX. Straight off BSD.

For a client machine I suggest using mounts to a netatalk server is a far better choice.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

drtechno
Posts: 242
Joined: Fri Apr 09, 2021 6:33 pm

Re: RPi 3B+ not appearing in macOS Finder

Sun May 09, 2021 11:34 am

epoch1970 wrote:
Sun May 09, 2021 10:44 am
drtechno wrote:
Sun May 09, 2021 10:16 am
macOS can do the same as above in a terminal window if they need to mount this share permanently on a machine. There should be plenty of guides out there because this is the common method macOS communicates with Linux.
Is it really? In my experience mounting NFS from OSX is fiddly compared to using netatalk.
This is the kind of stuff I have in /etc/fstab (it still exists) on my desktop Mac:

Code: Select all

ServerName:/FolderName - url net,vers=3,automounted,url==nfs://servername.domain:/mnt/some/export 0 0
It makes a "ServerName/FolderName" tree appear under "Network>Servers" in the Finder. This is automounted as the OS and especially Finder don't cope well at all with NFS targets disappearing, e.g. when switching location in network preferences.
Amazingly, settings for the automounter (at least until 10.13) are in /etc/autofs.conf in OSX. Straight off BSD.

For a client machine I suggest using mounts to a netatalk server is a far better choice.
Well that fstab entry is for the server side or file master endpoint. I'm surprised it even worked at some capacity.
The client side (Mac in this case) fstab would look like:

Code: Select all

192.168.2.11: /mnt/whiteTower/my_shares    /media/NAS1   nfs  rw,auto 0    0
But you have make the destination folder: /media/NAS1 in the Mac, otherwise it will not know where to mounted to.
This should end up as a nas represented as a removable drive. Their are two ways drives can be mounted in fstab: permanently or as a removable drive. If the machine doesn't go anywhere, you can set it up as a permanent drive, like a hard drive or raid connected to the system, otherwise, you would configure the mount device as a removable drive, since you take it away from the network.

epoch1970
Posts: 6505
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: RPi 3B+ not appearing in macOS Finder

Sun May 09, 2021 4:02 pm

drtechno wrote:
Sun May 09, 2021 11:34 am
Well that fstab entry is for the server side or file master endpoint.
Erm. Are you sure you know what you’re talking about?
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

MiscBits
Posts: 249
Joined: Wed Jan 27, 2021 12:48 pm

Re: RPi 3B+ not appearing in macOS Finder

Mon May 10, 2021 3:03 am

epoch1970 wrote:
Sun May 09, 2021 8:14 am
MiscBits wrote:
Sun May 09, 2021 1:09 am
...
Or use the “mimic-model” option in afpd.conf
http://netatalk.sourceforge.net/3.0/htm ... onf.5.html
Old habits and images die hard :-)

I'll try that next time - Thanks.
Is a computer language with goto's totally Wirth-less?

Return to “Advanced users”