Command not found in Mac terminal
The most likely reason why mac users might get this is because of something went wrong with users $PATH. Basically this path would be there in either bash_profile or ~/.zshrc file.
The users $PATH might not set in this file or the main abrupt reason which happens in most of the cases is opening the file adding something and not closing it back.
Like an example we have opened bash_profile with vi editor and adding something into that and before we save and close this if system gets shutdown or session gets expired then this gets stuck and another bash_profile.swp file gets created. This is what happened with my case.
Execute the below line which ll solve your problem.