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

I've tried putting

cd /Users/my_name/my_directory/structure

in both .bashrc and .bash_login but neither works, i.e. when I open a new terminal window I am in my home (/Users/my_name/) directory.

No error messages, just not cd'd into the directory as hoped when starting a new terminal window.

share|improve this question
up vote 3 down vote accepted

As Gerry mentioned, .bashrc is not read by login shells. New tabs are login shells by default in Terminal and iTerm 2. .bash_login is only read if there's no .bash_profile.

You could also add a cd command to .bash_profile.

share|improve this answer

First of all, if you are not using iTerm2 already, I suggest you download this free software as a replacement for

Among many other extra features, in iTerm Preferences, you can configure the default working directory for new shells. You'll find these settings in Profiles - General.

iTerm Default Working Directory

The advantage here is that you can set different behaviors for opening a new window vs opening a new tab or even creating a new split pane. I personally like staying in the current working directory when adding a split pane, for example.

You could do it in your startup script as well (though I find the iTerm solution cleaner, or at least more flexible), but then I advise you to use ~/.bash_profile instead.

~/.bashrc is not automatically sourced when opening a new shell window, and ~/.bash_login is only sourced if no ~/.bash_profile is present.

share|improve this answer
I always source my .bashrc from my .bash_profile so I don't have to remember which is called from where. – CajunLuke Aug 30 '12 at 22:52
@CajunLuke I do something quite similar: – Gerry Aug 30 '12 at 22:55
If modifying Working Directory’s “Directory” field has no effect, you probably need to switch Command from “Command” to “Login shell” (source). – duozmo Feb 10 at 17:32

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.