Spiffberrypi | Get it to appear in MAC Network + Windows *

https://miteshparmar1.medium.com/make-the-raspberry-pi-visible-on-your-mac-and-windows-computers-31c12e4e19d2

Previously I wrote about what a Raspberry Pi is and why you should buy one. Subsequently I wrote about how to install and configure a fan to run dynamically on the Raspberry Pi. Here we examine how to get the Raspberry Pi on the home network; present in Finder on the Mac and under ‘Network’ in Windows Explorer on the PC.

By default when the Raspberry Pi is connected to a router and has internet connectivity it is not visible to other computers on the same network. The reason you’d want it to appear is simply to allow you to drag and drop files to and from your computer to the Raspberry Pi.

Let’s get the Pi shown in Finder on the Mac first…

Quite simply, to get the Raspberry Pi showing in Finder on Mac OS X log into your Raspberry Pi (via ssh or directly).

Enter the following command and press enter to retrieve and install netatalk:

sudo apt-get install netatalk

For security reasons the installation does not by default provide access to the Pi so an installed file needs to be amended accordingly. To edit the config file type:

sudo nano /etc/netatalk/afp.conf

You only need to comment out a single line by removing the semi-colon character. Replace the /xxxx with /home:

img

Press ctrl+X to exit and press y to save changes.

Next we need to amend the .profile file so that netatalk is restarted when the Pi boots up and loads the .profile file. In the Terminal type:

nano .profile

This opens the .profile file which shows some text:

img

the .profile file when opened in nano

Scroll to the very bottom and insert the following command:

sudo systemctl restart netatalk

Press ctrl+x to exit and press Y to save changes:

img

That’s all there is to it! Now every time the Pi is restarted it will be shown in Finder on the Mac OS. To prove this restart the Pi by issuing the following command:

sudo reboot

Allow a few minutes for the Raspberry Pi to reboot and log back in.

On the Mac open a Finder window which should show an icon pertaining to the Raspberry Pi on the left-hand side. Click on this then click on the ‘Connect As’ button on the right-hand side:

img

Click on the ‘Connect’ button:

img

Enter the user credentials for the Raspberry Pi user (mine is pi) and click ‘Connect’:

img

An icon should be now present in the Finder window:

img

Double-click on the icon to access the home directory of user pi on the Raspberry Pi:

img

Now let’s get the Pi accessible in Windows

I think that instead of copy/pasting information that is already available in the public domain I’m just going to give the link of a YouTuber who has already done this and explained it concisely: https://www.youtube.com/watch?v=8FkiOfEgyvM&t=74s. Follow ‘Arcade Spinners’ steps verbatim and you’ll be able to connect to your Raspberry Pi via Windows and be able to map a network drive to the Pi too.

One caveat of networking the Pi in Windows is that it does not appear in the ‘Network Neighbourhood’ area of networked computers. You can only access it via the \{host_name} command in Windows. The reason being is because Microsoft have deprecated the SMBv1 discovery system. If you require the Pi to be seen in ‘Network Neighbourhood’ you need to run a Web Service Discovery Host deamon (wsdd). Thankfully, a developer has published this on his GitHub page. However, this does requires Python 3.

The Raspberry Pi OS by default uses Python version 2 despite Python versions 2 and 3 being installed by default. So we just need to make a minor change so the Pi uses Python 3 by default so the wsdd script will run seamlessly.

In a Terminal type the following:

python --version

This lists the version of Python being used by default. Mine shows version 2.7.16:

img

I need to change this to use Python version 3 installation instead every single time I log into the Pi.

Enter the following command to edit the .bashrc file:

nano ~/.bashrc

This is a hidden file residing in the user’s home directory (in my case pi) that behaves like a shell script every time the specific user opens a terminal. It helps configure the users environment so it already contains multiple vital commands.

Simply scroll to the very bottom and enter the following command:

alias python='/usr/bin/python3'

img

Press ctrl+X to exit and click on Y to save changes.

We can simply run the contents of the .bashrc script (to save you from logging out and back in again) by typing the following command:

source ~/.bashrc

Now check the version of Python by typing:

python --version

img

It should now show some version of Python 3 in use.

To run the wsdd file simply follow the GitHub Generic Installation Instructions.

Assuming the wsdd file is in your home directory, run the deamon in the background simply type the following command:

~/wsdd &

Now you may see a load of error output similar to this:

img

Don’t worry, the errors are non-fatal. Simply press ctrl+X a few times to get back to the terminal. Once your back in the terminal enter the following command:

jobs

This shows the background processes running on the Pi:

img

Now, if you check the ‘Network Neighbourhood’ on a Windows machine on the same network the Raspberry Pi should be visible:

img

NOTE: the wsdd process must be running continuously for the Pi to be shown in Network Neighbourhood. The moment the wsdd process is killed on the Pi it will no longer be visible in the Network Neighbourhood.

I hope this worked for you on both your Windows and Mac computers as it did for me. If so please leave a clap. If you have any comments, concerns or questions don’t hesitate to reply…

Scroll to Top