0

I mean change $HOME not by defining in ~/.bash_profile, but loading the variable when shell opens.

By the way, after some misoperation I cannot even get into the Terminal now... It now says [Process completed] and does not respond, as it should when every time it exits. Is there a way to configure or re-install the Terminal?

1
  • You have likely made a typo in your .bash_profile file. – CousinCocaine Sep 17 '14 at 10:12
0

I think the reason your terminal is acting up is that the default command has been changed somehow.

In preferences->Startup see what is set terminal preferences

I suspect that the Command is running something other than a shell. Change it back to Default login shell and all will be fine.

1

By default the $HOME variable is set to your home directory, you have nothing to do yourself in .bash_profile. I think something goes wrong in the process of starting your Terminal session. It is likely that your ~/.bash_profile is corrupt.

You can fix this without your terminal:

  • Open TextEdit and press CommandO to open a file.
  • Press CommandShiftG and enter ~/ to go to your home directory.
  • Now press CommandShift., this will make sure you can see hidden files.
  • Open .bash_profile, create a backup if needed, delete the contents and save.

This should fix your problem. You can try this for ~/.profile (if it exists) as well.

You can check your HOME variable by opening Terminal and type:

echo $HOME

This will return your current home directory. It is most likely that you do not want to change this. But if so, it is best to change it just before you run the command, not in your .bash_profile.


This example will show you how to change your HOME temporarily (for Bash):

# store original HOME location ('/User/CousinCocaine')
ORIGHOME="$HOME"
# set new home location    
HOME="/User/CousinCocaine/my/new/home/is/here"
# check new home location
echo "~/ " ~/
echo "\$HOME "$HOME""
# set home location back to original
HOME="$ORIGHOME"
# test old home location
echo "~/ " ~/
echo "\$HOME "$HOME""
2
  • Yep, I open shell with /usr/sh and everything goes fine. Thanks – cbear1985 Sep 17 '14 at 16:14
  • Then it is almost certain you have a corrupt .bash_profile file. In sh, do a rm ~/.bash_profile to remove this file and then your bash is up and running again. My strong advise is to use bash as your default shell instead of sh. good luck. – CousinCocaine Sep 18 '14 at 13:17

You must log in to answer this question.

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