Google have announced this week that they’ve opened up the Google Assistant SDK to developers. You can now use the Google Home assistant on your Mac. Read on to find out how to do it!
Building Google Assistant on a Mac
If you’re using an iMac or Macbook you can have Google Assistant up and running in 5 minutes or less. Here’s a step by step guide to getting Google Home working on a Mac computer.
1. Install Homebrew on Your Mac
If you haven’t already installed Homebrew this is the easiest way to do it inside the Terminal for Mac:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. Install Python 3 and Create a Virtual Environment for Google Home
First, you’ll need to create a directory for Google Home:
Now you can install everything in there:
brew install python3
python3 -m venv env
env/bin/python -m pip install --upgrade pip setuptools
3. Install the Google Assistant SDK on Mac
You should make sure to use sudo here to give super user permissions for the install on your Mac.
sudo python3 -m pip install --upgrade google-assistant-sdk[samples]
4. Create a Developer Project and Grant API Access
Head to the Google Cloud Platform Projects page and create a new project.
Enable the Google Assistant API for your new project in the Google API Manager.
Now go to the Credentials tab and create an OAuth Client ID. Tick the Other option and the create it.
You’ll finally be able to download a file similar to client_secret_XXXX.json (where XXXX is unique to you.) Copy this file into the googlehome directory you created earlier.
5. Google Home Works on a Mac!
Grant your new Google Home for Mac access to your Google account with this command:
python -m googlesamples.assistant.auth_helpers --client-secrets client_secret_XXXX.json
Ensure to replace client_secret_XXXX.json with your client secret filename.
Test your audio (this will record a 5 second sample from your Mac’s microphone and play it back):
python -m googlesamples.assistant.audio_helpers
Ready to talk to Google Assistant on your Mac for real? Run this command:
python -m googlesamples.assistant
Now just hit enter to start chatting. You’ll even see your speech transcribed on the screen! More commands and tips here at the official Google Assistant SDK page on GitHub.
Permission Setting Problems? Do This!
If you try chatting with Google Assistant and hear, “Actually there are some basic settings that need your permission first. Just go into the Google Home app for details.”
You’ll actually need to head to you Google Account Activity Controls and enable these permissions:
- Web & App Activity
- Location History
- Device Information
- Voice & Audio Activity
That’s it, you’re all set!
Google Home Raspberry Pi Version
It’s now also possible to get a budget version of the much loved Google Home running on a Raspberry Pi 3. This is currently the official Google recommended method.
What You’ll Need to Build a Raspberry Pi Google Home
Have You Chatted with Google Assistant Yet?
Leave a comment and let me know about the best experiences you’ve had while talking to your very own homemade Google Home!