Terminal bash commands stopped working I was trying to install some stuff for scala development on my MAC, and probably I managed broke the shell/terminal while I was mindlessly running some scripts that I don't know.

Now when I start the terminal it always starts with this line;

$ /sbin:sbin:/usr/local/bin': not a valid identifier


And now when I try, I see some bash commands does not work, for instance grep, syslog..etc I get an error saying;

-bash syslog: "no such file or directory"   


Any idea what is wrong and how can I fix this
Try to edit the .profile or .bash_rc file on the terminal 

 /usr/bin/vi ~/.profile


and see if one of the software has put stuff in there that should not be there (especially if one has put up a messed PATH command there).  (Alternately but less likely affected are  /usr/bin/sudo /usr/bin/vi /etc/profile or /usr/bin/sudo /usr/bin/vi /etc/bashrc).

If you don't know how to use the VI editor, you can also use /usr/bin/nano instead of /usr/bin/vi

For a start, until you find where this happens, editing the .profile (see above) you can put the following command as the last command to the end of your ~/.profile file.

export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin


This should at least give you back access to your normal commands.