For the last couple of years I have been developing with technologies that require spending a fair amount of time in a terminal session. I’m a Mac user (even an admitted Apple fanatic) so for years when I needed to SSH into a remote server, launch my local MongoDB server or start the Grunt or Gulp build process for a project, I reached for Terminal.app to get things done.
Then a few months ago I started using the free iTerm 2. At first I really didn’t see the advantage of using iTerm2 over Terminal.app. While iTerm2 had a few more visual customizations that Terminal.app, the difference didn’t seem that great. Then I found 2 features that, for me, made all the difference in the world.
Profiles allow you create and save a collection of settings for a particular thing that you do over and over so that you can easily launch an iTerm window with those settings again later. Once these settings are saved, launching a new iTerm2 window with that profile is 2 clicks away: Profile Menu > <selected profile>. In the screenshot below, you can see that I’ve set up profiles to launch my local instances of Tomcat, MongoDB server, and MongoDB shell, as well as a few profiles for various things to do with applications that I work on.
As you can see in the screenshot below, each profile is highly customizable and you can create as many as you want. In this screenshot, I’ve set up a profile to launch the NodeJS-based API for a demo app that a friend and I created for a session we gave at NCDevCon 2015.
So, the Profiles feature of iTerm to is very useful to quickly launch things that you work with on a regular basis and save a lot of typing. But wait, there’s more…
The real power of iTerm2 in my opinion is the ability to “stitch” various profiles together to form a group of things to be launched at once. I mentioned the conference session we did at NCDevCon 2015 earlier. The demo application for that session was an AngularJS application that used MongoDB for storing data. We had set up a Gulp task to run a local HTTP server with live reload and a Gulp task to compile CSS, concatenate JS files and get the application ready for browsing. All those things run in Terminal windows so naturally I created a profile for each one. Then I used iTerm’s ability to split existing Windows horizontally and vertically to put them all in one “window” so I could see them all simultaneously like you see in the screenshot below.
Once I got the layout like I wanted, I went to Window > Save Window Arrangement and gave it a name of “NCDevCon 2015”. The next time I came to work on the demo app, all I had to do was go to Window > Restore Window Arrangement > NCDevCon 2015 and all 4 of those profiles started up in the exact same layout as last time.