Tuesday, July 26, 2016

How to: Setup genymotion/genyshell commands in zsh

After you install Genymotion on MacOS, it's installed in the Applications folder. Unfortunately, the PATH variable is not set automatically, therefore running:
in the Terminal will result in an error.

In order to fix this, so that every time you open the Terminal or restart your PC, you need to setup your profile to export and add the correct paths to the $PATH variable. Here are the steps for zsh users:

  1. Open the zsh profile for editing: sudo vi ~/.zshrc
  2. Add the following lines at the end of the file, so that the genymotion paths for App and Shell are both added tot he $PATH on startup. In previous/next versions, the paths to the Genymotion.app and Shell may have changed so you can verify these.

          export GENYMOTION_APP=/Applications/Genymotion.app/Contents/MacOS
          export GENYMOTION_SHELL=/Applications/Genymotion\ Shell.app/Contents/MacOS/

          export PATH=$PATH:$GENYMOTION_APP

      3. You can now test your setup by running source ~/.zshrc which will execute in the current terminal your updated profile script
      4. You can see the PATH contents with echo $PATH or try running genymotion and genyshell from terminal.

Happy scripting!

1 comment:

Vasil Trifonov said...

I had to add the following path to the path environment (as I found here - https://github.com/NativeScript/nativescript-cli/blob/master/docs/man_pages/project/testing/emulate-android.md#prerequisites):