Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

macOS Quick Start Guide

leala-amzn edited this page Feb 26, 2019 · 60 revisions

This guide provides step-by-step instructions to set up the Alexa Voice Service (AVS) Device SDK on macOS. When finished, you'll have a working sample app to test interactions with Alexa.

WARNING: This guide doesn't include instructions to enable wake word.

Prerequisites

Software

Tool Minimum Version
Python 2.7.x
Xcode -
Homebrew -

To install Homebrew:

  /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Get started

  1. Register an AVS Product and Create a Security Profile, if you haven't already. It must be enabled for Code-Based Linking.

  2. Make sure that Python 2.7.x is installed on your system:

    python -V
  3. Update Homebrew:

    brew update
  4. Set up your build environment. Create a my_project folder, and these subfolders: build, source, third-party, application-necessities > sound-files.

    cd ~/
    mkdir my_project
    
    cd {my_project}
    mkdir build source third-party application-necessities
    
    cd application-necessities
    mkdir sound-files
    
    cd ~/{my_project}
  5. Install curl-openssl, which is required to connect to AVS:

    cd ~
    brew install curl-openssl
  6. Install the core SDK dependencies:

    cd ~
    brew install gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-libav sqlite3 repo cmake clang-format doxygen wget git

    IMPORTANT: Make sure that command ran successfully, and that no errors were thrown. If for any reason the install command fails, run brew install for each dependency individually.

  7. Install and configure PortAudio. Portaudio is required to stream microphone input/output data.

    cd ~/my_project/third-party
    wget -c http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz
    tar xf pa_stable_v190600_20161030.tgz
    
    cd portaudio
    ./configure
    
    make

    IMPORTANT: If you see "error: cannot find 10.5 to 10.12 SDK", then run:

    ./configure --disable-mac-universal
    
    make
  8. Clone the SDK into the ~/my_project/source folder:

    cd ~/{my_project}/source
    git clone git://github.com/alexa/avs-device-sdk.git

Set build options

  1. Use the CMake parameters in this section to customize how the SDK builds. To get debug logs from the sample app, include the -DCMAKE_BUILD_TYPE=DEBUG option. For more information, see Debug builds.

In this example it is declared that gstreamer is enabled, and provides the path to PortAudio, and also enables debug logging (which is optional):

cd ~/my_project/build

cmake /~/{my_project}/source/avs-device-sdk \
-DGSTREAMER_MEDIA_PLAYER=ON \
-DCURL_LIBRARY=/usr/local/opt/curl-openssl/lib/libcurl.dylib \
-DCURL_INCLUDE_DIR=/usr/local/opt/curl-openssl/include \
-DPORTAUDIO=ON \
-DPORTAUDIO_LIB_PATH=/~/{my_project}/third-party/portaudio/lib/.libs/libportaudio.a \
-DPORTAUDIO_INCLUDE_DIR=/~/{my_project}/third-party/portaudio/include
-DCMAKE_BUILD_TYPE=DEBUG

make
  1. Now, you can build the SDK by running this command:
 make SampleApp -j2

Note: You can use -j3 or j4 to run processes in parallel during make.

If you want to build the full SDK, including unit and integration tests, run make instead of make SampleApp.

Authorization

After you have built the SDK, you'll need to configure and authorize it to access AVS using Login with Amazon (LWA). To do this, follow these authorization instructions.

Set up launch shortcut

You can designate aliases to launch the sample app. To do this:

  1. Open ~/.bash_profile. Add these aliases and save:
    IMPORTANT: Make sure you update the paths to match your folder structure.
    alias alexac="~/{my_project}/{build}/SampleApp/src/SampleApp {build}/Integration/AlexaClientSDKConfig.json"
    alias alexacdebug="~/{my_project/build}/SampleApp/src/SampleApp ~/{my_project}/{build}/Integration/AlexaClientSDKConfig.json DEBUG9"
  2. After you've added these aliases, make sure to activate your ~/.bash_profile:
    source ~/.bash_profile
  3. Now the sample app can be launched with this single command:
    alexac  

Common issues

See the Troubleshooting Guide.

Next steps

Clone this wiki locally