zsh: permission denied: gam

13,697

~/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

Share:
13,697

Related videos on Youtube

Next-Door Tech
Author by

Next-Door Tech

Updated on June 04, 2022

Comments

  • Next-Door Tech
    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 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.

    • xrisk
      xrisk over 5 years
      Try a which gam in zsh maybe.
    • Next-Door Tech
      Next-Door Tech over 5 years
      which gam returns gam not found
    • xrisk
      xrisk over 5 years
      Check your path then.
    • Next-Door Tech
      Next-Door Tech over 5 years
      echo $PATH returns /Users/dmaadmin/bin/:/usr/local/bin:/usr/bin:/bin:/usr/sbin:‌​/sbin:/Applications/‌​Wireshark.app/Conten‌​ts/MacOS. gam is at /Users/dmaadmin/bin/gam/gam - in other words, gam should be on my path
    • xrisk
      xrisk over 5 years
      Then double check that gam is executable.
    • Next-Door Tech
      Next-Door Tech over 5 years
      ls -l returns -rwxr-xr-x 1 dmaadmin staff 8360244 Dec 21 2017 gam in ~/bin/gam/
    • xrisk
      xrisk over 5 years
      Aha! 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
      Next-Door Tech over 5 years
      Thanks! 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
      Next-Door Tech over 5 years
      I 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 why gam worked in bash but not in zsh