A decade of dotfiles

, posted

My first commit to my dotfiles repository was ten years ago. Here are a few things I’ve learned about maintaining a system configuration in that time.

(This will mostly be for macOS and Linux. I don’t have experience configuring Windows or FreeBSD machines, for example.)

Tools I like

Tools I made

In another decade, I bet I’ll learn that half of these are already covered by built-ins that have been around since 1970.

Prefer scripts over aliases

Let’s say I want to have a custom command called foo. I could do this in one of three ways:

  1. Add an alias to my shell configuration, like alias foo=...
  2. Add a function in my shell configuration, like foo () { ... }
  3. Write a full shell script, and add it to my $PATH

I usually prefer to do the last option: a full shell script. It’s a bit more heavyweight, but it has a couple of advantages:

I do this by having a folder, bin/, which I add to my $PATH.

It doesn’t work for everything. For example, I have a boop command (which I mentioned above) that needs access to the previous command’s exit status—as far as I know, that’s impossible with a script.

Every computer is different

I’ve stopped trying to make my configuration work effortlessly on any computer. Some amount of manual work is required to scaffold a new machine. In other words, I don’t have a fancy provisioning script any more.

What works well on macOS may not work well on Ubuntu, and what works well on your modern laptop might not work well on some old server. And don’t get me started on Windows—for better or worse, that’s a very different environment.

I used to have setup scripts that would provision a new machine with a single command. These scripts got complicated and rarely worked exactly right. Instead, I try to organize things to be customizable per machine.

There are several parts to this:

The stuff above is certainly helpful, but I’d be lying if I said it was seamless. However, this piecemeal approach is simpler and is way less of a headache than trying to have fancy setup scripts. (For me, anyway!)

This probably wouldn’t work if I were provisioning machines frequently. I only provision a new machine a handful of times a year, and most of the time those are virtual machines. I’d probably want something more automatic if I did this more often.

Every person is different

Saying that I’ve been maintaining my dotfiles for a decade is like saying that I’ve been decorating my home for a decade. I probably know what works for me, but that doesn’t mean I know what you’ll like!

Another ten years?

Who knows what computing will look like in ten years? People are improving every part of the developer stack, from the operating system to the terminal to the editor, and my work changes a little bit every day. Maybe I won’t have any dotfiles in 2032, or maybe I’ll still be tweaking my .vimrc.

In any case, it’s been a lot of fun!