How to fix .bash_profile when Terminal won't work

JChlip picture JChlip · Sep 12, 2012 · Viewed 12.7k times · Source

I was trying to customize my prompt in Terminal. To do this, I tried to edit .bash_profile using vim, but ended up with a .bash_profile.swp file. Following some posts I found online, I used the :recover command in vim, which created a new .bash_profile and then deleted the .swp file. However, now Terminal does not seem to work. When I open it, I get the below message:

-bash: c: command not found

-bash: end: command not found

[Process completed]

Does anybody know how to fix this?

Answer

Ansgar Wiechers picture Ansgar Wiechers · Sep 12, 2012

Something in your .bash_profile isn't as it should be. You seem to have a c and an end in it that bash interprets as command. If you post the contents of the file (without comment lines) either here or in a pastebin we'll probably be able to tell you where exactly those are.

Pressing Cmd+Shift+. in the file open dialog of TextEdit (or a real editor) should display dot-files in the dialog.