Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Hi i just installed iTerm2 and tried to open a tab with the same directory as the tab that open it.

I tried Zsh: Open a new tab in the same directory answer but still can't get the directory working.

It worked fine in but when im using iTerm it's not work anymore

share|improve this question
up vote 4 down vote accepted

It does work for me. Are you sure your .zshrc has the osx plugin loaded? Check for the existence of the function with:

$ type tab
tab is a shell function

Then, in your terminal, simply run the command


This will execute the appropriate line in the tab() function defined by the osx plugin. If it works for, it should also work for iTerm2.

In order to map this command to a custom keyboard shortcut like CmdShiftR, do the following. Open up and create a new Service. Set it to receive No Input from and drag Run AppleScript from the left to the editing pane.

tell application "iTerm"
    tell current terminal
        tell current session
            write text "tab"
        end tell
    end tell
end tell

That should look like this:

Save it under Open new Tab with zsh or similar. Now, under System Preferences » Keyboard » Keyboard Shortcuts, under Services, assign a keyboard shortcut.

Note that not all keyboard shortcuts are available, and you can't just override CmdT since this is a built-in one.

share|improve this answer
Note: You need to actually type tab into the terminal to create a new tab. Not through Shell » New Tab or ⌘T – slhck May 30 '12 at 10:35

You don't need a custom command anymore...

Preferences > Profiles > [Profile Name] > General > Working Directory > "Reuse previous tab's directory"


share|improve this answer

I solved this by adding -l to Command in my Profile settings. fix iterm

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.