How to restore .bash_profile on a mac? None of my unix terminal are working [closed]
I added something to my bash_profile while trying to add Playframework to my path and something got messed up badly.
I added the following line to my .bash_profile
export PATH=$PATH:the path to my play excitable
then I saved everything and restarted my terminal. I can no longer do anything from my terminal. I can't cd into any directory, I can no longer find java, I can't open vi or nano. I found this thread on SuperUser that suggested opening a different terminal and changing the bash profile.
I tried opening bash by typing
/bin/bash
and I was successfully able to open another terminal but I still don't have access to any of the regular unix commands. I still wasn't able to open vi or nano to remove the line that is causing the problem.
I tried downloading a new terminal application without any luck.
I tried turning on hidden files so that I can just change the file with a text editor by running the following command:
defaults write com.apple.finder AppleShowAllFiles TRUE
but since my terminal isn't working that didn't work either.
How can I fix my computer.
Solution 1:
While this is offtopic for stackoverflow, it's also pretty simple to fix:
- Start Terminal.app.
-
Reset
$PATH
:$ export PATH=/bin:/usr/bin:/usr/local/bin
-
Fix
~/.bash_profile
:$ vi ~/.bash_profile
Or you can avoid setting $PATH
at all with:
$ /usr/bin/vi ~/.bash_profile