Build Google Assistant for MacOS

This guide shows you how to build the Google Assistant for MacOS.

The Google Assistant SDK lets you add voice control, natural language understanding and Google’s smarts to your devices. Your device captures an utterance (a spoken audio request, such as What’s on my calendar?), sends it to the Google Assistant, and receives a spoken response in addition to the raw text of the utterance.

The SDK comes with reference sample code in Python for prototyping on hardware such as the Raspberry Pi or in this case the Mac(with MacOS). This sample code handles authentication and access to the Google Assistant API.


Step 1) Installing Pyton

First we we need to install the latest version of Phyton (if not already installed) open the terminal and instal pyton3.

$ brew install python3

Homebrew installs pip3 for you.

Step 2) Setup your a virtual environment

For this example I have chosen to install the project on my Deskop but feel free to run it anywhere you want. Use a new virtualenv

cd Desktop 
python3 -m venv env
env/bin/python -m pip install --upgrade pip setuptools
source env/bin/activate

3) Install the latest Google Assistant SDK and samples package

python -m pip install --upgrade google-assistant-sdk[samples]

4) Authorize access to the Google Assistant API

4.1) Go to:

4.2) Click CREATE PROJECT for creating new project.

4.3) Name your project. Here, I have called mijn: Jarvis.

4.4) Open your project by clicking the project name.

4.5) Open API Manager Dashboard and navigate to API Manager => Dashboard and click ENABLE API.

4.6) Open Library and Search Google Assistant Click the Enable Button for enabling Google Assistant API and. Create credentials for it.

4.7) open Credentials and goto OAuth Consent screen. Enter product name and leave everything as default, and save it.

4.8) Go to credential and click OAuth Clinet ID
Choose Other and give it a name and hit Create button. Now you created and authentication key.

4.9) Download the Credential by clicking down arrow. You’ll get an json file.

Move the client_secret_XXXX.json file into the folder we created earlier


5) Authorize access to the Google Assistant API

Lets get our assistent authorized by telling the assistant auth_helpers about the json file we just downloaded.

Run the helper and copy and past the url the it returns in the terminal. After opening the url you have to Authorize with your Google Account, when you autorised your account you will be redirected to a page with an an authorization code. Copy and past this code back in to the terminal and your all set and done.

python -m googlesamples.assistant.auth_helpers --client-secrets client_secret_XXXX.json
Please go to this URL: ...
Enter the authorization code:

6) Run Google Assistant

# Make sure you are in the virtual environment
source env/bin/activate
# Run Google Assistant
python -m googlesamples.assistant

Originally published at

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.