Tuesday, March 27, 2012

Sudo xxx complaining command not found

Problem:
Just installed doctrine. I found if I use command "doctrine" straight away it works but not working with sudo. When I typed in
sudo doctrine
it complains
sudo: doctrine: Command not found
Then I tried to use full path of doctrine with sudo which worked. So I think this should be caused by that sudo command does not use the personal path environment.

Using full qualified path every time is annoying.

Solved:
Create a file at
~/.bash_aliases 
with content
alias sudo='sudo env PATH=$PATH $@'
Logout and login again.

No comments:

Post a Comment