zsh: permission denied: gam
~/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
Related videos on Youtube
Next-Door Tech
Updated on June 04, 2022Comments
-
Next-Door Tech over 1 year
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 myPATH
.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.-
xrisk over 5 yearsTry a
which gam
in zsh maybe. -
Next-Door Tech over 5 years
which gam
returnsgam not found
-
xrisk over 5 yearsCheck your path then.
-
Next-Door Tech over 5 years
echo $PATH
returns/Users/dmaadmin/bin/:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Wireshark.app/Contents/MacOS
.gam
is at/Users/dmaadmin/bin/gam/gam
- in other words, gam should be on my path -
xrisk over 5 yearsThen double check that
gam
is executable. -
Next-Door Tech over 5 years
ls -l
returns-rwxr-xr-x 1 dmaadmin staff 8360244 Dec 21 2017 gam
in ~/bin/gam/ -
xrisk over 5 yearsAha! You say that
/Users/dmaadmin/bin/gam/gam
should be in your path, but there is no reason it should! Only~/bin
is in your path, not~/bin/gam
. -
Next-Door Tech over 5 yearsThanks! I was under the impression that including a folder in your path also meant that any subfolders would be added as well. Problem solved!
-
Next-Door Tech over 5 yearsI guess calling
gam
was trying to execute the folder~/bin/gam/
, so zsh wasn't sure what to do with it. The install script also only modified .bashrc, explaining whygam
worked in bash but not in zsh
-