Develop Faster with iTerm Profiles and Window Arrangements

My friend, Jon Kinney, was showing me how he’s able to jump into dev mode with his server, Rails console, database console, test suite and Vim all running at once using tmux and the tmuxinator gem. I was obviously jelly and I wanted to find a way to do something similar, but since I don’t really use terminal Vim for regular development I thought tmux was overkill for just starting up my server, consoles and tests so I decided to find a way to be more productive in iTerm 2.

Using split panes, profiles and window arrangements we can create a workspace that has everything we need to be productive and we can launch it with a single click. Here’s a preview of the kind of thing you can do:

A preview of the terminal setup

Above we have a regular terminal session, Rails console, database console and server running in 4 different panes.

Profiles

In order to open all the panes and run the commands to start our server, console, etc., we need to create profiles for each type of pane. You can create a profile by going to the Profiles tab in the settings pane. Give it a name and set the command you want to execute when the pane opens in the Send text at start input. You might also need to select the Reuse previous session’s directory as the working directory.

Here are the settings for a profile that I use to start a Rails server:

Preview of iTerm's Profiles tab

Window Arrangements

After you have your profiles setup, you can setup your workspace the way you want and then save the arrangement to use it again later. To create a new pane, use Command + Option + Shift + H for a horizontal split, or Command + Option + Shift + V for a vertical split. When creating a split, it will ask what profile you want to use.

Once you have your panes setup the way you like, just hit Command + Shift + S to save the window arrangement. Unfortunately, you can’t set a hotkey for different window arrangements, but you can launch your default arrangement with Command + Shift + R.

Other Tips and Tricks

  • You can save tabs in your arrangements as well. One cool thing I’ve used this for is starting up a bunch of web services I’m working on so all the APIs are available locally. This would be a huge pain without a saved window arrangement.
  • You can dim, adjust the dimness and animate the dimming for inactive panes under the Apperance tab in the settings.
  • Command + Option + [Arrow Key]: Switches to the next pane in that direction.
  • Command + Shift + Enter: Maximizes the active pane. I find this to be really handy when digging through server logs and stuff.
  • Command + [ or ]: Select the previous ([) or next (]) pane.
  • You can customize the hotkeys by going to the Keys tab of the settings.
  • Eric Chernuka

    Chris,
    How did you go about obtaing that sweet Terminal color scheme and bash profile?

  • Danny

    Thanks for posting this; I couldn’t work out how to save window arrangements :)!

  • roblevintennis

    Chris … extremely helpful guidance on creating groups in iterm2! I liked this so much I made a youtube vid (and credit and who your post of course!): http://www.youtube.com/watch?v=WOrwEYu_QiY – I’m new to iterm2 but was bedazzled by my coworker who was dragging these grouped terms around ;)

    • Nice! Glad this helped you out and thanks for the shout out on your screencast :)

      • roblevintennis

        Gotta give cred ;)

    • Nice! Glad this helped you out and thanks for the shout out on your screencast :)

      • roblevintennis

        Gotta give cred ;)

  • AplycaTeam

    This really makes a difference on my day. Thanks a lot for sharing.
    Now I can brag to other people ;)

  • pixelpeitsche

    Thanks for this post. It was extremely helpful to get a perfect workspace. Again, thanks a bunch!!!

    • Awesome, man – glad to hear this helped you out!

  • pixelpeitsche

    Thanks for this post. It was extremely helpful to get a perfect workspace. Again, thanks a bunch!!!

    • Awesome, man – glad to hear this helped you out!

  • Created a ruby gem for functionality just like this, would love some feedback.

    https://github.com/briangonzalez/termrc

    • Looks awesome, thanks for sharing Brian!

      • David Cuthbert

        “Unfortunately, you can’t set a hotkey for different window arrangements…”

        Turns out you can! If you bind a shortcut key to the action “Select Menu Item”, you can then scroll through your menu choices to pick out Window > Restore Window Arrangement > (arrangement name). Just discovered this a minute ago.

  • Created a ruby gem for functionality just like this, would love some feedback.

    https://github.com/briangonzalez/termrc

    • Looks awesome, thanks for sharing Brian!

    • David Jones

      After spending an afternoon experimenting with tmux and tmuxinator, this gem is *exactly* what I needed. All the benefits of tmuxinator without the need to learn tmux or lose any of my iTerm goodness. Thanks for a brilliant bit of open-source work!

  • David Cuthbert

    “Unfortunately, you can’t set a hotkey for different window arrangements…”

    Turns out you can! If you bind a shortcut key to the action “Select Menu Item”, you can then scroll through your menu choices to pick out Window > Restore Window Arrangement > (arrangement name). Just discovered this a minute ago.

  • Thanks! This was really helpful.

    • Thanks for taking the time to comment, @Brentmc79:disqus! Glad it helped :)

    • Thanks for taking the time to comment, @Brentmc79:disqus! Glad it helped :)

  • Leonardo

    Thank you much for this!!

  • Adam

    Thanks! Very helpful article!

  • Thanks for the post!I recently wrote a tool that allows you to do this on steroids, so you can specify a

    variety of window/pane layouts but also specify commands that those panes should run as you open them. In this way you can have a configurations for all of your various projects.

    You can grab it here: https://github.com/TomAnthony/itermocil

    https://raw.githubusercontent.com/TomAnthony/itermocil/master/itermocil.gif

    • Mike Pacer

      This looks great — exactly what I was looking for/was contemplating trying to hack together.

      • Awesome! Let me know how you get on with it! :)

    • I’m using it

  • Stephen Murphy

    Thanks for this. Very useful and works perfectly in Iterm 2 version 3 beta (that’s a name)

  • Gustavo Bezerra

    I am currently using iTerm2 3.0.7 but I can’t seem to get this “Arrangements” feature to work windows using a style different from “Normal”. That is, arrangements saved using “Full Width Top of Screen” and “Fullscreen” window styles don’t seem to work and trying to restore them ends up with nothing happening. Anyone else having that problem?

  • Great post. I’ve been looking for some keyboard shortcuts for splitting panes and creating profiles. Sadly there are certain shortcuts which conflict with Spectator keybindings. I know iTerm has got an option to remap keybindings but still it requires some effort.