Homebrew Corrupts PATH Variable on OSX Maverick

A failed attempt to install a Homebrew package on a Maverick OSX Macbook Pro was terminated by a Cntrl-C process break. Afterwards, the ZSH shell profile is corrupted such that :

uname zsh: command not found: uname

man zsh: command not found: man

ps zsh: command not found: ps

cat zsh: command not found: cat

echo $PATH /usr/sbin:/usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/local/sbin:PATH:/usr/local/opt/curl/bin

/Users/..../.rvm/scripts/rvm:12: command not found: uname /Users/.../.rvm/scripts/rvm:15: command not found: ps

npm --version 5.5.1 parse_git_dirty:11: command not found: tail

Upvotes: 0

Views: 928

Answers (2)

r_2009
r_2009

Reputation: 103

You should check the ~/.zshenv, ~/.zshrc, and ~/.zshprofile configurations to see if there's an incorrectly set $PATH environment variable, and the startup files that zsh loads.

My issue turned out to be in an extra backslash \ added to the PATH in ~/.zshenv, from some command that automatically set up the path.

Adding the /usr/bin to the PATH with export PATH=/usr/bin:$PATH can help to debug the issue within the shell.

Upvotes: 0

LiQIang.Feng
LiQIang.Feng

Reputation: 148

add /usr/bin to your PATH first

export PATH=/usr/bin:$PATH

Upvotes: 0

Related Questions