$PATH error on a terminal

Before you raise your pitchforks, this is NOT another "How do I change my $PATH variable value?" question. I had installed Oh my zsh on my machine(Macbook Pro), and didn't like it. So I uninstalled it.

Ever since I installed it I get the following when I run the $PATH command:

Anups-xxxx-xxx% $PATH
zsh: no such file or directory: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin

How do I get rid of the bit that says zsh: no such file or directory. Thanks in advance!


Okay, so you've got a good understanding of $PATH and how it's used, but you're mistaken in thinking that it's a command. In Bash (and other shells), words prefaced by a dollarsign are variables. You can change the value of $PATH with the export command (as you probably already know).

export PATH=$PATH:/path/to/something/you/need/bin

So in your shell when you just type $PATH you're basically telling your shell to run the command /usr/bin/:/bin/:/usr/local/bin:/etc//etc//etc/ which isn't a valid shell command.

@patrix was right, you should use echo to inspect your $PATH. I suspect that the "zsh: no such file or directory" is just your shell telling you that your command doesn't make sense.


If you think there should be a path command, use this:

alias path='printf "${PATH//:/\\n}\n"'

This will display the contents of your $PATH, one element per line.

[665] mbp13 $ path
/opt/local/bin
/opt/local/sbin
/usr/local/bin
/usr/bin
...
[666] mbp13 $