Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

To be clear im not looking for a workaround that will execute a change directory command on startup. I want to alter the $HOME env var so that tilde commands work and so that entering a 'cd' command will return me to that directory.

I am sure it is possible I am just not able to find the command.

I have tried setting it in my /etc/profile but it doesnt seem to work. I have tried about 4 different settings in there. The ones I can remember trying are:

$HOME = /directroy
$HOME = "/directroy"
setenv HOME /directory

I may be missing something simple but I'm unable to find a solution.

share|improve this question
Actually I wonder more why HOME is not already set correctly when the shell starts. If you open a new tab in Terminal, what is the result of echo $HOME? – patrix Jun 6 '13 at 6:41
@patrix I probably should have been more descriptive. It is "correctly" set to my user's home directory. I would like it to be a different directory as all of my terminal use is based out of another directory. – Andrew Jun 6 '13 at 16:22
I strongly recommend against doing that. The convention that $HOME points to your home directory is strongly embedded in Unix space and lot of shell scripts, perl scripts, binaries rely on that. You will get better results by defining something like MYROOT=/Users/andrew/base/of/all/things and then use $MYROOT where appropriate. – patrix Jun 6 '13 at 16:57
up vote 2 down vote accepted

In bash (the default shell of Terminal on 10.8) the syntax:

export HOME
share|improve this answer

Expanding on @patrix comment, change your $HOME/.bash_profile file to add the following lines:

export MYROOT

This way you will get you will start your shell in /path/to/dir/you/want and using cd $MYROOT will bring you back there.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.