Search code examples
macosmacos-sierraactions-on-google

Can't install gactions CLI


I'm trying to install the google actions CLI.

The docs: https://developers.google.com/actions/tools/gactions-cli

I followed the commands here as well as from the question/answer here.

I downloaded the Mac x86_64.

Then ran the following command on it: Run chmod +x gactions to make the binary executable.

It did turn the file into an executable. When I clicked it, it opened in terminal and did something.

enter image description here

However in a new tab in terminal it still does not understand the gactions.

enter image description here

Also I don't use terminal but iterm2, so I tried opening the executable in iterm2 and got this error.

enter image description here

How to update $PATH

I placed the gactions file here

enter image description here

My current $PATHs

export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export GOOGLE_SDK_PATH="/Users/leongaban/Projects/YumBrands/GoogleHome"
export TERM="xterm-256color"
export NODE_ENV

Solution

  • The gactions file you downloaded is the executable itself - not an installer or anything along those lines. You can put it somewhere in your PATH or call it directly by giving the full path when you're calling it, but it will not be automatically available unless you do so.

    You can see your PATH with echo $PATH. If you wish, you can place it in one of those directories.

    If you wish to continue to run it out of your Download directory (which I do, since I rarely use the command), you can open an iterm2 command line and call gactions with the full path:

    ~/Downloads/gactions
    

    or (using your example)

    ~/Projects/YumBrands/GoogleHome/gactions
    

    Or (also using your example) you could add the following line (probably to your ~/.zshrc file) to reference the gactions command in the GoogleHome directory:

    PATH="$PATH:$HOME/Projects/YumBrands/GoogleHome"
    

    You can then open a new terminal or iterm2 window and confirm that this is in your path

    echo $PATH
    

    The normal way to use it would be to create a directory where you are developing your Action (I use ~/Documents/Projects) and have gactions create the default action.json file. Possibly something like this:

    mkdir ~/Documents/Projects/new-sample-action
    cd  ~/Documents/Projects/new-sample-action
    ~/Downloads/gactions init
    

    (If you have updated your PATH, you can just use gactions init for the last line.)