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

  • What files did you edit did you edit when you did the install - probably your shell initialization files e.g. .bashrc, .bash_profile and others – Mark Jun 14 '13 at 10:03
  • FYI, to disable customizations so you can start a shell to edit a shell startup script, you can use Terminal's Shell > New Command item to run bash --noprofile, which will start Bash without running the login script. – Chris Page Dec 16 '15 at 14:09

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.

  • tnx for the quick fix I will try that, but I didnt understand what should I do with the files you mentioned, and no idea how should I edit them – Spring Jun 14 '13 at 10:36
  • 1
    For a first diag (most likely culprit), show/add the current content of your ~/.profile file in your question text – Bbrado Jun 14 '13 at 10:38
  • tnx I will do it in evening – Spring Jun 14 '13 at 10:41
  • I just checked, there is no .profile file under ~/. how should I put it back? I dont use time machine – Spring Jun 15 '13 at 10:24
  • ahh I checked bashprofile file. and there was an extra space in one of the paths! problem solved! but .profile is still missing..hope thats not a problem – Spring Jun 15 '13 at 10:27

You must log in to answer this question.

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