I'm using Mac OS X Lion 10.7. I open Terminal and its window shows up but immediately close and its icon remains in the dock. It's working fine a moment ago. I don't know what i have messed. I looked at the log file in the Console application and see "login: USER_PROCESS 172 ttys000"
This looks as if there is an issue with one of the configuration files for your shell. To fix do
- With Terminal still running, use Shift-Cmd-N to run
ls -l .bashrc .profileand rename all files you found (
mv .bashrc .bashrc.save,
mv .profile .profile.save)
- With the window still open, type Cmd-T to open a new tab running
- Assuming this worked, review
.profile.save(and anything called from there) for errors. You can also rename them back and run
loginin the running shell which may show some errors from executing the scripts and give you some hints on where to look for problems.
- In case running
bashin step 3 didn't work (tab closed again) you may also have to rename
sudo mv /etc/profile /etc/profile.save; sudo mv /etc/bashrc /etc/bashrc.save
I recently had this issue because I uninstalled the version of bash installed by macports (
/opt/local/bin/bash) not realizing it was my default shell. The solution was to change my default shell back to
/bin/bash via the advanced user options in the Users & Groups System Preferences. (See @sdmeyers' comment on @Pyrolistical's answer for instructions.)
Try to hide the current
~/.bash_profile from your shell.
Just rename it to
~/.bash_profile_bkp and see if something changes.
What shell are you using? Try flipping the default one. I found a bad .profile configuration crashed bash, and temporarily switching to another shell to edit the .profile fixed my issue.