Configuring Your OSX Terminal

For fun and productivity!

Hello and welcome back! This edition of my newsletter is about how to configure an attractive and functional terminal environment. I’ll be walking through my current setup (pictured below) which uses iTerm2, the Dracula color theme, Meslo LGS Nerd Font, and the Fish shell with the Tide theme. This tutorial is geared towards OSX so your milage may vary on Linux and Windows systems.

Why Should You Care?

As always, why should we bother with this in this the first place?

Given the justifiable momentum right now to low-code and no-code solutions in the data space, the command line might not be a high on many people’s list of favorite tools. But, even as we gain new SaaS tools the command line remains an incredibly powerful systems programming tool. For folks in the analytics space, the command line is useful for everything from parsing and peeking at data to setting up your Python environment. Using the terminal becomes essential as your work gets to closer to the Data Engineering and DevOps domains (even if those words aren’t in your job title).

But for a lot of people who work in data, and even some engineers, the terminal is their least favorite tool. The steep learning curve and dramatic failure modes aside, it doesn’t help that terminal environment itself can feel like stepping back in time — forget linting and autocomplete, there aren’t even any colors!

But check this out …

That’s my current terminal setup pictured above. From left to right you can see my system type, my current working directory, my git branch, the number of staged and untracked files in that repo, which virtual environment I’m using, and the timestamp of the last command. On the next line I’ve started to type git add and tests/ is being suggested as an autocomplete option based on the modified files in the repo.

These aren’t just neat tricks, all this information clearly displayed helps prevent many of my most frequent command line mistakes. Notice that form is as important as function here. The font face is clear down to the details in the file icon. The colors clearly separate out different information. There’s visual whitespace between each command. Theses are little things but when you are staring at a terminal for hours a day these little things add up.

Lastly, I think there’s something to be said for the educational value that comes from taking ownership of your tools; customizing them, breaking them along the way, but ultimately learning how they work.

Let’s get started!

iTerm2

Let’s start by downloading the iTerm terminal emulator for OSX. iTerm is a feature-rich alternative to the built-in OSX terminal application. Some of the features that I use regularly are:

  • Better control of font size, font, and transparency

  • Tabs, Split screens, and moving panes

  • A configurable status bar (visible at the bottom of the screen shot above) that can show things like location, git info, CPU and memory use.

Even just this handful of features is a quality of life improvement over the OSX Terminal app. Note that iTerm only runs on OSX so Windows and Linux users can skip this step. The good news is that the Linux terminal (or at least on Ubuntu) can already do most of what I use iTerm for. Windows users should look at setting up WSL 2 which gives you a native Linux terminal your Windows environment.

Colors

Now that we have a better terminal environment let’s get rid of the default black and white color pallet. We want our color theme to provide helpful highlighting as well as reduce eyestrain and be aesthetically pleasing. iTerm already comes with a few built-in color presets which you can find under Preferences > Profiles > Colors > Color Presets. Personally, for years I used the popular built-in Solarized Dark theme and would switch to Solarized Light in bright lighting conditions like outside. Lately, I've switched to the Dracula color theme (the background story is worth a read).

If none of these appeal to you can grab all the iTerm2 color files you want from this repo. They're a little hard to interpret but you can find plenty of "best of” lists on web that can guide you toward the most popular ones. After you download them you can import and select them from the same Color Presets menu.

These colors might not look like much right now, but as we keep going they’ll start to pop a bit more as our terminal makes better use of them.

Fonts

Typefaces are a rich world of nerdiness unto themselves with their own subculture of designers. There’s a documentary on Helvetica. There are books about type faces (including one by some good friends of mine). All this is to say that while you might never have given the font in your terminal much thought — some people have.

OK, but what if don’t want a research project and just want a good font? From what I’ve read, a safe bet for OSX users is the Meslo LG font family which you can read more about here. I picked Meslo because it’s a monospaced font designed for software applications and is specifically optimized for OSX systems and displays. But this optimization means it doesn’t always look great on my external monitors, in which case I switch to the Source Code Pro family.

But wait! These are not exactly the typefaces you want to install. We’re going to make our terminals fancy (🧐 🎩) by choosing variants of our fonts that include glyphs from the Nerd Font family. For the font families I mentioned these are the Meslo LGS Nerd Font and Source Code Pro Nerd Font (aka “Sauce Code Pro” for namespace reasons). We’ll make use of these new glyphs in the next section.

Lastly, make your font bigger. While reading small font won’t permanently damage your eyes, it does cause eye strain. Many of us correct for this by hunching over and squinting without even realizing it, leading to muscle strain and headaches. Here is an experiment you can try; make your font just a little bit bigger than you think it needs to be and then see if you even remember to change it back.

Fish Shell and Themes

So far, we have a modern terminal emulator, a nice color theme, and a sharp font. Now let’s bring them all together. Within your terminal you are always working in a “shell”. You can think of a shell as a scripting language for interacting with your operating system. The most common shell is called bash; though the OSX default recently switched to zsh, a more modern bash-compatible option.

For the past few years though I’ve been using Fish Shell, a user-friendly shell that come set up with things like color highlighting and extensive auto-completion for everything from git to unix commands (“Finally, a command line shell for the 90s”).

There is a trade off. Fish achieves at least some of this by not being bash compliant. I’ve found this is rarely an issue as Fish will respect a #!/bin/bash header and otherwise I can drop in to a bash shell anytime I need to. In contrast, almost every command I run in Fish gives me some kind of value such autocompleting file paths.

Fish works great out of the box but to the get the best experience I prefer setting a theme with a plug-in manager. All of these themes will make heavy use of the Nerd fonts we installed earlier. For the past few years I've been using the Oh My Fish plugin manager with the default theme. I briefly used the bobthefish theme but the Powerline-inspired aspects were too distracting for me.

In the process of writing this up I came across the Tide theme which is not supported by OMF but you can install using the Fisher plugin manager. I like this theme quite a bit, in part because of the built-in setup manager that walks you through a customization workflow. This is the setup I have pictured at the top of the article and my new default on my personal and work computers.

Whatever you pick, there is a a fork in the road here because you can't have both OMF and Fisher installed on the same system because they try to edit the same Fish configuration files — so you do have to pick one.

That’s it! Hopefully you have a more functional and attractive setup now or have otherwise learned a little bit more about the tools available to you.

Odds and Ends

It’s been a little bit since I’ve put out a newsletter. I’ve spent a good portion of that time playing with some the frameworks I wrote about in my last edition including a [Dagster MVP](https://github.com/acviana/dagster-advent-of-code) built around an Advent of Code challenge that I want to write up at some point.

And while all that has kept me busy the truth is that writing is hard and I’ve gotten stuck on a lot of the drafts I’ve started. But I think I’m learning how to write more tightly-scoped newsletters that should be easier to get out the door.

Anyway, here are some odds and ends for you.

Around the Internet:

Reading:

  • Go Ahead in the Rain: Notes to a Tribe Called Quest: I finished this wonderful book, part history of ATCQ and part personal memoir of the author as he was growing up with the group. Probably my favorite hip-hop book since I read the 33 1/3 series on Nas’s Illmatic.

  • Thick: And Other Essays: I’ve been following recent McCarther Genius Award recipient Dr. Tressie McMillan Cottom for years so I’m glad to finally put some money in her pocket. Her first volume of her essays is effecting and profound. She also has a great substack where she talks about everything from her writing process to Peloton to Dolly Parton.

Listening:

I’ve been bouncing around a lot but lately. Not really loving anything too much but this is what’s been at the top of my rotation:

  • On a recommendation I checked out Benny the Butcher’s The Plugs I Met 2 (mostly for the Harry Fraud production)

  • Floated around some SoCal Lo-Fi pop by Little Monarch

  • Went down a Chicago blues history rabbit hole listening to Alligator Records first artist Hound Dog Taylor

  • My personal favorites The Hold Steady put out a pretty decent studio album


Thanks for reading! You can catch me on twitter at @AlexVianaPro, on GitHub, or on LinkedIn. If you want to subscribe there’s probably a button on this page to do that. Thanks to my wonderful wife for helping with my innumerable typos.