I followed the cli-walkthrough to do the install using homebrew. I seem to be getting this issue with anything I install, it has happened with Visual Studio Code, tldr and Homebrew itself. They all worked fine after initial install then somewhile later (I expect after a reboot) they no longer work in the terminal. I even had to manually create the ~/.zshrc file and add the export path for Visual Studio code to get the code command to work.
This fixed the issue for Visual Studio code but it seems to be happening for every application I install. I expected this would be something that MacOS does automatically. I can’t even use the brew command now even though I used it to install both the exercism-cli and tldr.
mitch@colossus ~ % brew update zsh: command not found: brew
I’m also not sure on where the exercism executable is, there is the below directory on my computer but this just contains the few exercises that I was able to download while the CLI was working. I can’t see any executables or additional files there when running ls -la
It seems to me that either something about your shell environment has changed, or you are not actually in the shell you think you are.
Try using env to print out the actual environment variables that are present in the current shell. It’s possible that whatever terminal or shell you are using is not actually loading your ~/.zshrc file.
To fix brew in the short term, you could put the path into $PATH just like you did for VS Code: /opt/homebrew/bin/
export isn’t needed because the PATH doesn’t need to be exported. The shell uses the shell variable PATH (which does not need to be an exported/env var) to find executables. The PATH is being reset every time you start a new shell so there’s no need to export it to have it persist from shell to shell. You can create a new shell without PATH in the environment to test this out. (The env command helps you create a clean environment. export -n can un-export a variable.)