iTerm Tear Off Tabs

2 minute read

I like iTerm 2 (and I can not lie). I use a Mac and spend most of my days in the terminal (and Emacs). When a window system first came into my life, it was X Windows. It’s terminal software, xterm, had a pair of features that are hardwired into me, copy on select and paste on middle button (though these days getting a decent middle button is a pain). OS X’s Terminal does not do either of these things, so it’s out.

Let’s look at another feature of I like iTerm 2. Normally, opening a new window or tab creates a new login in your home directory, exactly what you’d expect from a terminal program. However, you can choose instead to open a shell in the current directory, letting you add another window on whatever you are doing.

Choosing the working directory

I really like the “new window in the current directory” feature when I’m already running a server in one window, have a console in another, and want to start tailing the log. However, when I’m opening a window to work on something new, I find it annoying to be dropped somewhere deep in my directory tree. And, unfortunately, it’s a preference you set per profile, you can’t choose the behavior when opening a window.

A simple approach to get both behaviors is leave the default profile as is and add a second with the same directory behavior. However, that second profile will have one of iTerm 2’s ugly three key keyboard shortcuts (four if you want a new window) instead of it’s handy ⌘-N and ⌘-T shortcuts.

Here’s the trick. Under the Working Directory profile, there’s Advanced Configuration. From there you can set different behavior for new windows vs new tabs (and new split panes, something I never use). I leave new windows set to Home directory and set new tabs to Reuse previous session’s directory.

Advanced working directory settings

Now when I want a new fresh window I hit ⌘-N. When I want another window like the one I’m in I hit ⌘-T and get it as a tab. Since I don’t love tabs, I just tear it off into it’s own window. If you are a tab person, you can do the reverse, creating a new window and dropping it on another to create a tab.

It’s a small thing, but I think you’ll find this is a help and easy to use workflow.

Tags:

Updated:

Comments