Search code examples
command-lineterminalzshiterm2zshrc

Terminal errors - "zsh: command not found" when trying any command


I was adding a path to my zshrc file earlier on and after saving the file and re-opening up my Terminal, I've found that I am unable to use any command what so ever.

The error I get back on any command I type in is this:

enter image description here

No matter what I try typing in I get this error, I have not been able to reopen my zsh file either to remove the paths I added as there is obviously an issue with them.

Can anyone advise the best thing to do to fix this without having to reboot my entire OS?

Many thanks in advance


Solution

  • Use the macOS Finder to rename the .zshrc file to .Xzshrc or something.

    • .zshrc is in your home directory. One way to navigate to that directory is to enter Shift+Command+H.
    • Since the filename starts with ., it's a hidden file. To get Finder to display hidden files, enter Shift+Command+..

    Now you can restart Terminal, and rebuild your .zshrc file, copying pieces from .Xzshrc as needed. The error is probably in a path assignment.