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 May 7, 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.

Note: The following examples use /Users/username as the SDK installation location; be sure to replace /Users/username with your explicit path.

```shell
cd /Users/username/
mkdir my_project

cd my_project
mkdir build source third-party application-necessities

cd application-necessities
mkdir sound-files

cd /Users/username/my_project
```
  1. Install curl-openssl, which is required to connect to AVS:

    cd /Users/username/
    brew install curl-openssl
    echo export PATH="/usr/local/opt/curl-openssl/bin:$PATH" >> ~/.bash_profile
  2. Install the core SDK dependencies:

    cd /Users/username/
    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.

  3. Export the openssl package configuration path:

export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig:/usr/local/Cellar/openssl/1.0.2r/lib/pkgconfig:$PKG_CONFIG_PATH”
  1. Install and configure PortAudio. Portaudio is required to stream microphone input/output data.

    cd /Users/username/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
  2. Clone the SDK into the /Users/username/my_project/source folder:

    cd /Users/username/my_project/source
    git clone git://github.com/alexa/avs-device-sdk.git

Build the SDK

  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.

This example declares that GStreamer is enabled, specifies the path to PortAudio, and enables debug logging (which is optional):

cd /Users/username/my_project/build

cmake /Users/username/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=/Users/username/my_project/third-party/portaudio/lib/.libs/libportaudio.a \
-DPORTAUDIO_INCLUDE_DIR=/Users/username/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.

Additional resources

Clone this wiki locally