Zsh: permission denied: exercism

getting error “zsh: permission denied: exercism” while trying to install cli on WSL2

What exactly are you typing (please copy/paste)?

Did you follow all the bash install instructions? Did you add it to your PATH? For zsh, you need to change the bash rc file to the zsh rc file.

In the future, please share text as text, not as an image!

Note how you modified the PATH in the ~/.bash_profile; you’re going to want to update your zsh profile if your shell of choice is zsh.

What are the permissions on the file? What is the output of this command?

ls -l ~/bin/exercism

-rw-r–r-- 1 admin admin 8818688 Oct 4 15:29 /home/admin/bin/exercism

You need to set the executable bit (x) to run the file:

chmod a+x ~/bin/exercism
1 Like

This solved the problem but when executing command
➜ exercism submit ./currency-exchange/exchange.py
the same error arises
zsh: permission denied: exercism

I’m confused. This both solved the problem and the problem still persists?

Once again, what’s the current permissions on the exercism file? What is the output of type exercism?

Hi Isaac!

Could you please help me on this?

Here are the permissions on the file:

-rwxr-xr-x 1 rofarah rofarah 8818688 Oct  4 06:29 /home/rofarah/bin/exercism

Does echo "$PATH" show /home/rofarah/bin in the value?

1 Like
/home/rofarah/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

Note how /home/rofarah/bin is not in the PATH. In order for zsh to find exercism, the directory needs to be added to the PATH. This typically involves something like adding: PATH+=":$HOME/bin" to your shell rc file. I believe the Linux install instructions explicitly lists that command … for the bash rc file.

Thank you, Isaac!

Do you believe this might be a solution?

1 Like

I’m not a zsh user but that looks roughly correct. Minor nit: I would put `~/bin at the end of the PATH list vs at the start.

1 Like

Another minor nit. The export isn’t needed. You can just set PATH="$PATH:$HOME/bin"

1 Like

Would this be the correct command?

echo 'PATH="$PATH:$HOME/bin"' >> ~/.zshrc
source ~/.zshrc

I am sorry, but as a begginer I don’t know if the single and double quotes (above) are correct…

Yup! That looks correct to me.

In shell scripting, single quotes are string literals and the contents are not changed by the shell. Double quotes are “regular” strings and expansions (generally, stuff starting with a $) are expanded.

Problem solved, Isaac! :smiley:

But when I run …

exercism download --exercise=say --track=python

… the exercise is downloaded in a different folder (not inside the path I am actually running the command).
I mean, a “exercism” folder is automatically created inside “home/rofarah”, but this is not the folder I would like to keep downloaded files.
Is there a way to chose a specific directory in order to download the files?

» exercism --help
A command-line interface for the v3 redesign of Exercism.

Download exercises and submit your solutions.

Usage:
   [command]

Available Commands:
  configure    Configure the command-line client.
  download     Download an exercise.
[...]


» exercism configure --help
Configure the command-line client to customize it to your needs.
[...]
You can also override certain default settings to suit your preferences.

Usage:
   configure [flags]
[...]
Flags:
  -a, --api string         API base url
  -h, --help               help for configure
      --no-verify          skip online token authorization check
  -s, --show               show the current configuration
  -t, --token string       authentication token used to connect to the site
  -w, --workspace string   directory for exercism exercises
[...]

You can use the exercism configure command to update the --workspace, i.e. the directory for exercism exercises