Asher
Asher

Reputation: 317

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

Upvotes: 3

Views: 33698

Answers (3)

iku
iku

Reputation: 974

Sourcing Your .bashrc into .zshrc

If you want to use your existing bash configurations (like aliases or paths), you can source your .bashrc into your .zshrc file.

Just set the following line to at the top of the ~/.zshrc file,

source ~/.bashrc

Upvotes: 1

Klaylton Fernando
Klaylton Fernando

Reputation: 31

In NVM repository shows how to add source lines to correct profile file:

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

Source: nvm

Upvotes: 1

Gairfowl
Gairfowl

Reputation: 2981

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.

Upvotes: 7

Related Questions