1

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!

1
  • 2
    err, there is no $PATH command. If you want to see your PATH you have to run echo $PATH.
    – nohillside
    Jul 27, 2012 at 15:57

2 Answers 2

2

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.

1
  • Zsh expanded the variable, then tried to interpret it as a command named bin contained in some impossible directory specification. Sep 22, 2021 at 4:33
1

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 $ 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .