How to reset Bash on Mac OSX, .bash_profile corrupted and bash no longer works
Just putting all my comments together for an answer:
First thing you should do is change the shell, this way you can set a shell that will not load the bash init-scripts (.bashrc
, .bash_profile
) - how to do this for the Mac OS X terminal app can be seen here: Apple Support
Now you should be able to open a terminal again and use your favourite command-line editor to open the .bash_profile
file (e.g. nano
or vi
):
In this file you have to reset your PATH
variable that is used by the terminal to find the programs it can execute.
This can be done with the following two lines:
PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$PATH" # Make sure to use double quotes not single quotes And on a new line
export PATH
This will first set the directories that you want to have on your PATH and the export this PATH to make it available to all programs started from this shell (via export).
⇧⌘. shows hidden files in file dialogs. You could try opening ~/.bash_profile with TextEdit and making it blank temporarily.
I was running on the same problem, and I just found simpler solution:
/usr/bin/nano .bash_profile
delete all your mess, then save the file