Search code examples
macosshellzshoh-my-zsh

zsh: permission denied: gam


I am using ZSH on macOS 10.12 with Oh My ZSH installed.

I recently installed GAM on my computer using the provided install script bash <(curl -s -S -L https://git.io/install-gam)

The script installs the command line tool gam to ~/bin/gam/gam, which is in my PATH.

However, when trying to execute any gam command in ZSH, I get the following:

➜  ~ gam info user
zsh: permission denied: gam

However, when executing the same (or any) command in bash, the tool works as expected.

I have been able to get the command to work by placing alias gam="~/bin/gam/gam" in my .zshrc, but this causes some unexpected issues with gam arguments beginning with ~.

~/bin/gam/gam has execute privileges as well as its accompanying folder ~/bin/gam/, so I can't figure out what's wrong here.


Solution

  • ~/bin/ was in my PATH but the subfolder ~/bin/gam/ was not. Calling gam would cause ZSH to find the folder ~/bin/gam/ and try to execute it, hence the permission denied error instead of command not found.

    The reason gam worked in BASH was because the install script only added ~/bin/gam/ to my PATH in .bashrc and not .zshrc