0

each other commands does not work

MacBook-Pro ~ % open . zsh: command not found: open

however after entering this PATH=/bin:/usr/bin:/usr/local/bin:/sbin:${PATH} export PATH

in mac always getting zsh: command not found:

everything works. why? why after entering this path everything is works and how I can solve this problem?

  • It's normal for executables to work when you have a correct PATH, so I don't know why there's a "why?" question to be answered there. – Charles Duffy Aug 28 '23 at 16:41
  • How you came to get an _incorrect_ PATH is a different question, but that's something where we'd need to know the contents of your dotfiles. Note that one respect in which zsh breaks from POSIX convention is having the name `path` be special -- code that changes `path` will also change `PATH`. But while that's a question, it's not a question that's _on-topic here_; Stack Overflow's scope is narrowly limited to questions about writing software; [unix.se] is more appropriate for general UNIX usage/configuration topics. – Charles Duffy Aug 28 '23 at 16:43
  • BTW, maybe `echo "$PATH"` or `declare -p PATH` will provide a hint as to how your PATH came to be wrong, by showing you the incorrect prior value if you run them before explicitly setting a correct value. (`echo` and `declare` are both shell built-ins, so they work even when external commands don't). – Charles Duffy Aug 28 '23 at 16:47
  • That's how `PATH` (respectively, since you are using zsh, also `path`) is supposed to work. You can MAGICALLY enter a command, without specifying the path to the command explicitly. What a relief!!! But if you are not familar with this fundamental property of Unix/Linux/MacOS, please study [this page](https://linuxconfig.org/linux-path-environment-variable). – user1934428 Aug 28 '23 at 17:06
  • FYI this is the wrong site - Stack Overflow is for programming q&a. Consider reposting to [apple.se] or [unix.se] – David Makogon Aug 29 '23 at 00:41

0 Answers0