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

In GNOME Terminal of Ubuntu when you open a new tab the new shell will automatically start you in the current working directory of the active tab shell.

E.g. if in the active tab shell I am on ~/myproject and I open a new tab, the new shell will start on ~/myproject too.

As you can guess, this is very convenient when you work deep in the directory hierarchy.

Can I configure the OSX terminal to have this behaviour?

If not, is there any free (cocoa) terminal that does this?

share|improve this question
up vote 7 down vote accepted

You may use iTerm2 and just select in preferences to "reuse previous tab's directory"

enter image description here

share|improve this answer
I also recommend using iTerm2 as a Terminal replacement. I did come from the linux world, and finding a good gnome-terminal replacement for mac was a must. – mspasov Mar 29 '11 at 15:37
Looks nice! Thanks! – m000 Mar 30 '11 at 19:54
I'd like to add that this behavior can be configured in recent versions of as well. – Gerry Aug 30 '12 at 22:22

Here's my solution from a SuperUser question

Get the current environment in your clipboard:

env | pbcopy

Open up a new Terminal window and export those environment variables

for env in `pbpaste`; do export $env; done

And to ease the process, you could always alias it, like so

alias get_env="env | pbcopy"
alias set_env="for env in `pbpaste`; do export $env; done"

So that all you have to do is

get_env +N set_env

The accepted solution:

osascript <<END 
tell app "Terminal" to do script "cd \"`pwd`\"" 

Place it in one of the folders in your path, make it executable (chmod +x filename). You can then run the name of this script to open a new terminal window in the same directory.

share|improve this answer
The osascript approach is nice. But it opens the shell in a new window instead of a new tab. – m000 Mar 30 '11 at 19:49

In recent OS X versions (Mavericks and Yosemite, not sure about earlier versions) in the preferences, "General" tab, there are options for "New windows open with" and "New tabs open with":

enter image description here

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.