This post may contain affiliate links. If you buy something through one of our affiliate links, we may earn an affiliate commission at no additional cost to you.

If you use an Apple device such as an iPhone or Mac and want to cast audio to a Google Home or Nest speaker using AirPlay, you’re unable to unless the app you’re using supports Google Cast. In this guide, we’ll cover how you can configure a Raspberry Pi to bridge the gap between Apple and Google, allowing you to AirPlay audio to a Google Home or Nest speaker on your network.

We’ll be using the terminal to set up everything we need, you can use the terminal directly on the Raspberry Pi itself or SSH in. For this to work, we’ll be using AirCast which is part of the AirConnect project on GitHub.

Click here to display content from YouTube.
Learn more in YouTube’s privacy policy.

Downloading AirCast

We’ll be downloading the files we need to a new subfolder the /var/lib directory so AirCast can be set up as a service later on in the tutorial. Use the following command to move into that directory and set up a subdirectory called airconnect.

cd /var/lib
sudo mkdir airconnect
cd airconnect

Before we download AirConnect, let’s check what architecture of Raspbian is being used on the Raspberry Pi, this is important as AirCast has specific versions for different architectures and newer models of the Raspberry Pi now support 64-bit operating systems.

uname -a

Within the result of the command, you are looking for either aarch64 or armv71. If you see aarch64 your Raspbian installation is 64-bit and you should use aircast-linux-aarch64 in the commands to follow, if you see armv71 your Raspbian installation is 32-bit and you should use aircast-linux-arm in the commands to follow.

Now, let’s download the AirCast file to the airconnect folder we have made, to do this we’ll use wget.

If you’re using 64-bit use the following command:

sudo wget https://raw.githubusercontent.com/philippe44/AirConnect/master/bin/aircast-linux-aarch64

If you’re using 32-bit use the following command:

sudo wget https://raw.githubusercontent.com/philippe44/AirConnect/master/bin/aircast-linux-arm

Now we have AirCast downloaded, we need to modify the file so it can be an executable file, use chmod to do this. Replace <aircast file> with the name of the file you previously downloaded.

sudo chmod +x <aircast file>

With the file now executable, we can run it with the following command, if it is successful you’ll see AirCast start to scan the network and list connected Google Home and Nest speakers.

./<aircast file>

Setting up AirCast

Let’s check to see if AirCast has automatically made a configuration file by listing all the files in the folder.

ls -a

I could not see a config.xml file in my folder, so I’m going to manually get AirCast to run to create a configuration file called aircast.xml and then automatically stop.

./<aircast file> -i aircast.xml

The configuration file allows you to tweak how AirCast behaves, as well as give custom names to your Nest and Google Home speakers if you wish.

Running AirCast as a Service

Now it’s time to make AirCast automatically run when the Raspberry Pi boots up, this can be done by setting up AirCast as a system service. Firstly, we’ll want to start working in the system folder on the Raspberry Pi.

cd /etc/systemd/system

Now let’s create an aircast.service file using the nano text editor. We’ll need to use sudo to do this as we are in system folders.

sudo nano aircast.service

Within the service file enter the following information, changing <aircast file> with the file name of your AirCast version and changing aircast.xml to your configuration file name if you have used a different file name.

[Unit]
Description=AirCast
After=network-online.target
Wants=network-online.target

[Service]  
ExecStart=/var/lib/airconnect/<aircast file> -l -z -x /var/lib/airconnect/aircast.xml
Restart=on-failure
RestartSec=30

[Install]
WantedBy=multi-user.target

When this information has been entered, press CTRL+X to exit the text editor, press Y when asked if you want to save and then press ENTER to confirm. Now let’s enable the service we just created.

sudo systemctl enable aircast.service

Now that the service is enabled we can start the service with the below command, you’ll only need to do this on the first run. Whenever your Raspberry Pi reboots the AirCast service will automatically start.

sudo service aircast start

If you ever want to disable the service, simply change enable to disable in the command and if you need to manually stop aircast change start to stop. You can also check the status of the aircast service at any time by changing start to status which will give you useful information on the service.

You May Also Like