Switching from macOS to FreeBSD.

🔗Configs and dotfiles

Before we get into anything else, here's a repo with my configs and dotfiles for running FreeBSD as a workstation.

A lot of the good stuff was cribbed from Jessie Frazelle's dotfiles repo, or from her post on running Linux on a MacBook. Check it out.

🔗Background

I've been using Mac OS X since the Public Beta, though not as a daily driver for a few years after it was initially released.

Pismo, PowerMac, PowerBook (12" albook!), MacBook, iMac... It's been a long road, really, and until the last few years I've been very happy.

Before OS X, I used Linux or OpenBSD as a desktop (and before that Windows 3.1), and was generally pretty happy for many years, but I did spend a lot of time screwing around with X11 configs and dist-upgrade breaking my world, and all the usual stuff you might remember from 2003 or 2004.

Around then OS X started getting pretty usable, especially given my relatively simple professional needs:

  • A terminal
  • OpenSSH

Really, that's it, for work.

Obviously a web browser, and a media player were nice to have, but as a sysadmin most of my day is spent at a shell prompt on some other machine. Very little of the development work I do is on my local machine, but is instead housed in a zone on some compute node in some datacenter somewhere.

So for a long time OS X was good. Each release was faster on my existing hardware (no, really!) and less buggy, and sometimes had useful features I cared about.

Mostly I didn't use the new features, though, and as time went on the number of features and things it was doing I would prefer it not skyrocketed.

I used Terminal (and later iTerm2) and ssh. Safari got slow so I switched to Firefox, and then Chrome. All my media is in iTunes now, and yeah, it's kind of awful, but I don't spend a lot of time actually looking at it.

Circa OS X 10.6, I was really happy with OS X. It was fast, stable, and never got in my way.

Around OS X 10.9, though, things started going wrong. 10.10 improved a few of these things, but overall it just kept degrading. It's slower, there are a lot of really distracting "features" I can't seem to actually reliably disable: It's tied into my phone, and my wife's phone, so when she adds events I get duplicate notifications (deliver once being a fallacy, I suppose), disrupting me from my work. I disable this, but ...

It harasses me every day to upgrade. It desperately wants to just upgrade whenever it wants. More and more it acts like the Windows machines I've had to support over the last 20 years, which is deeply frustrating.

It regularly does things in the background without asking, consuming all my bandwidth (again: most of my work is remote, so I'm particularly sensitive to latency.)

And yeah: I've disabled all these things. They keep getting re-enabled, and so it's not hard to take the hint.

Periodically when I try to log into OS X, it will just hang on me, which is sort of beyond the pale.

Upgrades have gone sideways because there are files in /usr/local of all things. And now SIP in 10.11 breaks all sorts of stuff.

I've just been fed up for a while. I recognize that mostly it's because the thing that was working so well for me has now moved on -- it's this digital life hub thing, instead of a nice UX that let me run ssh reliably. So maybe it's not you, it's not me, it's just us. And that's ok.

Alternatively:

OS X has become an obnoxious puppy ("I WANTED TO LOVE YOU SO MUCH I PEED ALL OVER THE FLOOR"), and as I've grown older, I've become more of a cat person ("...you do your thing, I'll do mine. Cool? Cool.")

It was more about the constant distractions than the cost of maintenance.

🔗So What Then

I spent some time defining the problem and how I might solve it.

The primary issue was I spent too much time telling OS X to shut up and leave me alone. Some of this is me and how poorly my brain operates these days -- I've had 3 kids in the last 5 years. I don't like to play the twins card, but having twins does something to your brain. The doubled up sleep deprivation and long, long periods of stress altered me in non-trivial ways.

Time is precious and my mental state is constantly fragile. Focus is incredibly difficult to achieve and impossible to maintain if something distracts me.

I needed something that wouldn't bother me, or consume my time pointlessly. One way or another I was going to have to build this thing. Something off the shelf like what OS X 10.6 was for me was unlikely to simply exist.

I tried running various Linux on my MacBook, but discovered everything I hate about managing Linux on a server platform is in fact amplified in a desktop context. It was less bad than I remembered from 10 years ago, but it was still a poor comparison to when OS X was good -- again, for my requirements.

I tried to think of an extreme that wasn't too extreme -- something that was minimalistic, but not egregiously so (like just rocking a console and screen and no GUI at all.) Something that had features and technologies I cared about, without wandering off into the weeds periodically to bring me back a decapitated bird.

OpenBSD was my first choice. I've used it for many many years in firewalling or routing contexts, I used to use it as a desktop -- but the upgrade process sort of killed it for me. I didn't want to deal with patching and recompiling my OS, or remembering to look at a web page for errata (or writing a script to do that for me.)

I've used FreeBSD for projects in the past (circa FreeBSD 5.x) but not in years. However, they've integrated ZFS and DTrace from illumos (which is where I spend the vast majority of my time, logged into things), pf from OpenBSD, and they have both binary OS updates and packages.

If you poke around the FreeBSD site you'll notice two things which I also found to be extremely commendable: The FreeBSD Handbook is an amazing piece of documentation. It's far shorter than the Solaris System Admin Guides I knew and loved when I was getting started with Solaris in 2005, but it's a really well crafted piece of work.

The other is the FreeBSD Code of Conduct. CoCs are (rightfully!) becoming more popular with projects and conferences, and I don't know when they added theirs -- but it's well thought out, and I appreciate the effort there.

🔗The Workstation

I didn't want to install FreeBSD on my iMac. My wife uses it for photo and video editing, my music is all tied to OS X, sometimes I have an hour to play the latest Shadowrun game. Dual booting would just be a pain.

I decided to build a computer for home use. I hadn't done this in at least ten years -- I've built plenty of servers in that time, but at home I'd been happy to just have my Macs.

I was careful to find hardware that was slightly older, and well supported. I didn't want to end up with some device that was generally okay but periodically got flaky. I spent a lot of time reading forums, driver man pages, and so on. In retrospect I probably didn't need to do this much due diligence, but I was being paranoid about the time I might have to spend later fighting with the fallout of a poor purchasing choice.

I ended up purchasing:

So... for what I need, a quad-core box with 32GB RAM is pretty ridiculous. But I'm hoping I can not do this again for quite for a years, so. The case has plenty of room for disks, if that becomes a thing I need over time, as well. (Because, ZFS.)

(I include the CPU fan because it made me laugh while I was installing it. So ridiculous.)

My 4 (and a half she'd be quick to point out at the time) year old and I put it together one night after her sisters went to bed. She sat with me through the installation and I set up her first user account for her. For posterity, kid:

12:37:43 gaea:~$ uname
FreeBSD
12:37:47 gaea:~$ id nora
uid=1002(nora) gid=1002(nora) groups=1002(nora)

🔗FreeBSD Installation

I had done testing in VMs before I got the hardware, so I knew what to expect. And honestly -- there's not much to say here. I hit enter a bunch of times and then I had a system with ZFS on root, running FreeBSD. I was really pleased with how simple this was.

Both FreeBSD and OpenBSD have made huge strides in installation.

🔗FreeBSD Packaging

pkg(8) is a nice tool. The ports tree is massive, and I haven't found any software I needed that didn't exist there.

In a server context I'd have the same problems I do with any other distro packaging setup: Missing compile-time options one some things, etc, but for home use it's been very smooth sailing.

🔗FreeBSD Upgrading

The freebsd-update(8) tool just works. Sometimes it works so well I wonder if it actually did anything. I walked releases from 10.1 RELEASE, through security patches, up to 10.2's most recent patch level. Two commands each time, and zero problems with any of it.

freebsd-update fetch
freebsd-update install

🔗As A Desktop

There is a distribution of FreeBSD called PC-BSD that's targeted at desktops. However, if my goal was this minimal, stay out of my way, sort of environment, I didn't want a bunch of user-friendly add-ons trying to help me out. I wanted a simple environment that would help me focus.

This guide at cooltrainer.org was absolutely perfect for me. I had zero problems following it, and it got me a working GUI in under a half hour. The big kicker with X11 for me has always been fonts: They've historically been a pain to manage and setup. Either something has changed, or my threshold has moved, because with the exception of Google in Firefox I'm pretty happy with how things look.

The next decision I had to make required some experimentation: Which Desktop Environment to use? After poking at KDE, GNOME, LXCE, WindowMaker (yup), Enlightenment 17 (less said the better, and I ran E16 for ages back in the day) someone on Twitter (I can't remember who, now!) mentioned i3.

Back around 2003 I had co-workers and friends who were using ion and ratpoision, but I never really got tiling window manages for whatever reason.

i3, it clicked immediately. Loved it.

I stole most of Jessie Frazelle's dotfiles to make i3 and urxvt nice to look at.

(Initially I was using a terminal emulator called sakura, and it was nice enough. After I pulled in Jessie's dotfiles I figured I may as well just use urxvt like everyone else.)

I spent a few evenings on getting things setup how I want. With a new OS X install there was very little I'd do beyond customize my shell environment and change the window highlight from Aqua to Grey. (And enable FileVault, firewall, etc.) Spending time on configuring i3 didn't feel like a waste of time, though. It was iterative (as you can reload the configuration live) and the effects on my workflow felt immediate.

I really like i3.

This was back in April, and I've been happily using this setup for the last 7 months. I switch between the FreeBSD box and my iMac, depending on what I'm doing, but when I need to focus I'm in i3wm.

🔗On a Laptop

(My notes.)

After several months, I decided to try it on a laptop. I love the MacBook chassis, but the OS is making me nuts. FreeBSD doesn't support the wireless NICs in mine yet, and of course I can't swap it out.

A few hours of research later (looking at modern netbooks that appeared to be compatible) I decided to get a Thinkpad X220 based on a thread on misc@openbsd.

(Someone on that thread coincidentally mentioned that X220s could take 16GB RAM, regardless of the documented max being 8GB.)

Looking at used gear on eBay, I decided to get something with as little RAM, but a faster CPU, as possible. I ordered the laptop eBay, and a 120GB Intel SSD, and two sticks of RAM from Amazon.

I haven't used a non-Apple laptop in over a decade. Simply speaking from a physical, mechanical perspective, they're amazing machines. Incredibly well-engineered. They don't feel flimsy. I'd grown to like the chiclet keyboard, and never felt like the touchpad got confused or would activate incorrectly.

The touchpad on the X220 is pretty crap. The nub mouse is going to take some time to get used to. They keyboard is nice, though I keep hitting the nub instead of the B key.

xset b off and hw.syscons.bell=0 were something that took me a few minutes to remember, but oof. So necessary. The bell on this thing is like someone taking a ball peen hammer to a piece of tin inside your skull.

🔗Install

I couldn't get ZFS on root to work the X220's buggy UEFI firmware. I tried various things (legacy mode, MBR, manually writing zfsboot after install, FreeBSD 11 snapshot -- which has a fix for this, potentially, but the snap I tried was a bit buggy. I also don't want to be running HEAD. It goes away the "don't break" requirement.)

Finally, I split the SSD into 40GB UFS for the OS and another partition for a zpool.

In reality this doesn't effect me much. ZFS on root is nice to have, but I've been living without it on OS X, and I can live without on this laptop for a while longer.

Beyond that, the install worked just fine.

🔗Wireless

Wifi support was the big reason I chose the X220, so I was a bit frustrated when the system get reassociating with the network. After an hour or so of debugging and googling, I found a post that described the problem. The workaround was changing ifconfig_wlan0 in /etc/rc.conf to

ifconfig_wlan0="-ht WPA DHCP"

-ht disables 802.11n (see ifconfig(8).)

Once that was in place, everything worked great.

🔗Sleeping and Locking

FreeBSD won't sleep the laptop if you close the lid. Kind of a deal.

I felt sort of silly while I was writing it -- because I've been using Macs for so long -- but I wrote a i3 keybind to call i3lock and then acpiconf -s 3. It's similar to my keybind for just calling i3lock, so I imagine I'll sometimes screw it up, but it's easy for me to remember either way:

bindsym Control+Mod1+l exec i3lock -c 111111
bindsym Shift+Mod1+l exec i3lock -c 111111 && sudo acpiconf -s 3

(Requires sudo be configured for that command with NOPASSWD.)

🔗Hardware Upgrade

Swapping out the disk and RAM in the machine was trivial. You can add an mSATA drive if you want to mirror or get extra storage but for my use cases (basically a dumb terminal with all data I care about elsewhere) I decided not to bother.

🔗Performance

Both on the laptop and desktop, FreeBSD swims. To be fair, both machines have a ridiculous amount of RAM for what I'm doing (16GB and 32GB respectively; I mean c'mon), and an SSD -- and...

13:17:22 gaea:~$ ps -U bdha | grep -v ssh | grep -v bash
 PID TT  STAT    TIME COMMAND
 986  -  Ss   0:00.39 /usr/local/bin/i3
 993  -  S    0:00.88 i3bar --bar_id=bar-0 --socket=/tmp/i3-bdha.TvyJg3/ipc-socket.986
 995  -  S    0:00.06 i3status --config /home/bdha/.i3/status.conf
1000  -  S    0:00.77 urxvt -ls
1061  -  S    0:00.63 urxvt -ls
2847  -  S    0:07.91 urxvt -ls
2896  -  S    0:00.32 urxvt -ls
2964  -  I    0:00.00 /usr/local/bin/dbus-launch --autolaunch 2adb3a5ba60595820f094822554267df --binary-syntax --close-stderr
2965  -  Ss   0:00.00 /usr/local/bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session
3053  -  S    0:00.45 urxvt -ls
3350  -  S    0:00.00 /usr/local/bin/xclip -in -selection clipboard
3356  -  S    0:00.68 firefox
3022  4  I+   0:07.98 vim freebsd_osx_migration.txt
3359  6  R+   0:00.00 ps -U bdha

So it's hardly fair to compare it to anything else... but realtalk. It's fast.

It'll remain fast.

🔗The Problems

The biggest one I have is password sharing. All of my personal passwords are in 1Password. I've copied a bunch of them over to KeepPassX (which is what we use at work and on illumos infra), but syncing is definitely a pain point. I could stop using 1p, but honestly -- it's so convenient I'm used to not having to jump through an extra hoop to log into something.

Copy and paste is still a bit frustrating. Sometimes urxvt will get confused; it won't select things properly. I'm not happy with the hotkey I have set up for it. I imagine I'll put a bit more time into figuring out what's up here, because copying chunks of text shouldn't be something I ever have to think about.

On the laptop, I sometimes forget that I have actual pgup/pgdown keys. Will have to get used to that. :-)

🔗Conclusion

This was a long post, given my requirements were "doesn't break" but also "doesn't waste my time." It seems a bit odd that I spent so much time on customizing configuration here, like I would have done in (forgive me) my youth.

However, for me, this was a one-time cost and I'm getting a lot of out it.

I am less frustrated, and more focused working on this setup. A big chunk of that is even outside the constant popups in OS X, there's simply less to be distracted by.

I've gone so far as to have to literally switch a cable to move between machines (as opposed to a KVM), to help me train my brain into a different context.

Overall I'm quite happy with the choices I made here.

FreeBSD and i3wm are simple (in the best ways), fast, reliable, and most importantly for me -- non-invasive.