Jay McGavren's Journal

How a Head First author spends his days off

View on GitHub
2024-05-01

Coping with MacOS Sonoma for Web Development

This is the latest in a series of posts on using MacOS for web development. This fork of the original post is targeted at Sonoma (14.4).

For pretty much every Mac I’ve ever owned, I’ve copied my configuration from machine to machine. But when one does so, a lot of unused cruft builds up over the years. So I’ve decided to wipe everything and start totally (well, okay, mostly) from scratch. This is a rare learning opportunity and so I’m documenting my setup here, for my reference and for yours.

This post is intended to be a living document. I’ll be updating it as I discover improved settings. Comments and suggestions are welcome!

Be warned: I am an Apple skeptic. I don’t like the direction recent MacOS versions have gone, and many of my settings represent an attempt to get back to “the good old days”. If you’re one of those fans who think Apple can do no wrong, and you want to make use of all the latest MacOS features, you may want to find another configuration guide. Now get off my lawn!

Portable config with a dotfiles repo

You can do a mass copy of your user’s home directory from machine to machine, but that assumes you’re not recovering from a hard drive crash or stolen laptop. Far better to create a version-controlled repo (I use Git) with the contents of the “dotfiles” (.zshrc, .tmux.conf, etc.) in your home directory. Here’s my repo on GitHub:

https://github.com/jaymcgavren/dotfiles

To retrieve it I do something like this:

cd ~
git clone git@github.com:jaymcgavren/dotfiles.git

The repo includes a README with directions on how to link its contents so they’re used as your system config.

Developer Command Line Tools

We need the XCode “command line tools” before we can do much of anything from the terminal. These will take a long time to download and install so it’s best to get this going as soon as you can.

Install packages

We need to kick off a bootstrapping script to install other common tools you’ll need. This too will take a long time to run, and you probably can’t kick it off until the XCode tools finish installing.

After installing so many new programs, I’d recommend rebooting your machine, just in case.

Fix Terminal.app

By default, MacOS Terminal.app doesn’t treat the Option/Alt key as a Meta key. This breaks many shortcuts in set -o emacs mode (the default) as well as Emacs itself. Personally, I use iTerm 2 for my terminal, but we should fix Terminal.app regardless.

Window Manager

I avoid using the mouse as much as possible in my daily work. Sure, it’s well-suited for drawing and such, but for common operations like switching between apps, it’s unacceptably slow. MacOS supports some shortcuts like Cmd-Tab, but those are pretty limited.

That’s why I use a “window manager” app. A window manager can remember the positions your windows are in, and restore those positions for you at the press of a hotkey.

You have a few good options that I know of:

Fix System Settings

Next, let’s visit “System Settings” to fix some terrible defaults.

“Appearance” Preference Pane

Appearance: “Dark”. Might help you fall asleep after a late night hacking session.

“Lock Screen” Preference Pane

“Require password after screen saver begins or display is turned off”: “Immediately”.

“Trackpad” Preference Pane

“Point & Click” page

“Scroll & Zoom” page

“More Gestures” page

Disable all this crap! Mission Control, Exposé, Launchpad, all of it. Here’s why:

“Desktop & Dock” Preference Pane

Dock section

The dock is for damn dirty mouse/trackpad users, not for you. I don’t think it can be disabled entirely with stock software (please let me know if I’m wrong) but you can minimize how much it gets in the way.

Desktop & Stage Manager section

I don’t need to know what Stage Manager is to know I don’t care about it; it’s proprietary and therefore you don’t want to be habituated to it. As best as I can tell, here’s the most you can do to disable things; leave everything else at the defaults.

“Mission Control” Preference Pane

Don’t use Mission Control. Habituation to it promotes vendor lock-in with Apple. It’s for damn dirty mouse/trackpad users anyway. You’re going to use a window manager that lets you keep your hands on the keyboard.

The directions here for disabling Mission Control entirely used to work (as of MacOS 10.14.6). Now they don’t. The best you can do is disable everything in this preference pane:

“Keyboard” Preference Pane

“Keyboard Shortcuts…” window

Click the “Keyboard Shortcuts…” button to open this.

“App Shortcuts” section

This section of the Keyboard preference pane is important enough to get its own heading.

Click the + button to add or change keyboard shortcuts for menu items in various apps. You choose the application you want to modify, type the exact name of the menu item you want to invoke, and press the key combination that should invoke it.

Some suggestions for things to add are below.

“Text Input” section

“Notifications” Preference Pane

You may want to switch certain app alert styles from “Banners” (which could go away unnoticed if you step away from your computer for a moment) to “Alerts” (which stay until you clear them). Note that an app probably won’t appear in the app list here until you’ve launched it for the first time. (And maybe not until after the app shows you its first notification.)

Examples of apps to consider switching to “Alerts” include:

“Sharing” Preference Pane

“Users & Groups” Preference Pane

“Login Items” page

Some apps will set themselves up to open on login. For some this is great, for others it’s annoying or even peformance degrading.

Consider removing:

Consider adding:

Set Up Apps

Hopefully your bootstrap script installed all the apps you need. If not, install them now.

Log In to Services

Here are a few apps you’re going to want to open and log into, if you have/use them.

cd /Applications
# Some other apps depend on Google Drive, so do this first!
open 'Google Drive.app'
open '1Password.app'
open 'Google Chrome.app'
open Slack.app

Settings

Here are some other apps you’re going to want to change specific settings in:

Hope you found this post helpful (and not too surly)! I’m open to healthy debate about the merits of these settings. Who knows, you might even change my mind about something. Leave a comment below!

Copyright © Jay McGavren.