This Much I Know

November 18, 2018

How to support Dark Mode in websites on macOS Mojave:

@media (prefers-color-scheme: dark) {
    /* Your CSS overrides here */

April 15, 2018

Had a weird problem on a Mac running 10.13.3 where all WebKit-based apps could not access the Internet (Safari wouldn't load web pages, and the App Store had a big white nothing for all tabs; neither displayed an error, and Safari beachballed inside the web view), but other tools such as curl and ssh at the command-line worked as expected. Results from Google suggested running all of the maintenance options in the Mac cleaning tool OnyX. Rather than running everything, I ran groups of them based on intuition of what might be wrong. On the maintenence tab, the category that ended up solving the issue was one of LaunchServices, dyld's shared cache, or XPC cache.

January 21, 2018

If you find evidence that a laptop battery is expanding, it is an emergency to at the very least remove it. In only a few days, the gradual expansion will begin to split the computer open like a can opener.

October 22, 2017

When speech synthesis mysteriously doesn't work on a Mac, and to test, you run say something at a command-line, and get this:

Open speech channel failed: -76

Explicitly setting the voice ( -v Alex) temporarily works around the problem for say, and changing/resetting the voice in System Preferences fixes it for the rest of the computer. This happened right after upgrading from 10.10 to 10.13; the way voices are managed probably changed, and the OS installer probably forgot (or simply didn't) port my speech preferences to the value that 10.13 needs.

October 10, 2017

These days, I rarely need a spare USB thumb drive — but for the first time in a very long while, it was my only option.

July 20, 2017

To edit a past commit message in Git without using rebase:

git filter-branch -f --msg-filter 'cat > msg; test $GIT_COMMIT = <commit> && vim >&2 <&1 msg; cat msg; rm msg' -- <branch>

May 6, 2017

On Mac OS X 10.7, if you are unable to mount a volume, and you see these errors:

/var/log/system.log: diskarbitrationd[21]: unable to mount /dev/disk2s4 (status code 0x00000001).
/var/log/kernel.log: jnl: disk2s4: open: journal magic is bad (0x76697270 != 0x4a4e4c78)
/var/log/kernel.log: hfs: late jnl init: failed to open/create the journal (retval 0).

You can repair the disk using:

$ sudo diskutil disableJournal force /dev/disk2s4
An error occurred journaling the file system: The underlying task reported failure on exit (-69860)
$ sudo diskutil enableJournal /dev/disk2s4
Journaling has been enabled for volume tm2 on disk2s4

And now the disk will mount:

$ diskutil mount /dev/disk2s4
Volume tm2 on /dev/disk2s4 mounted

April 19, 2017

A clean, soft sock makes a decent case for an Apple Magic Mouse in a pinch.

March 31, 2017

A small copper brush is an excellent tool to have laying around in the house.

October 24, 2016

When using an old Mac OS X 10.5 machine as a NAS, the following command is helpful:

sudo defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool YES

September 17, 2016

Household electrical wire is tough. Extrapolation: never get in a fist fight with an electrician.

July 29, 2016

When cutting plexiglass, if the protective film is peeling off, do your best to tape it down, or else the lines you have carefully measured will move.

July 29, 2016

When cutting plexiglass with a circular saw, a blade designed for metal works better than a blade designed for wood.

June 18, 2016

Returning home from WWDC: It took me 1 hour and 40 minutes to check out of my hotel, take the BART to San Francisco International Airport, check my luggage, pass TSA, and walk to the correct gate.

June 15, 2016

When touring the food establishments around San Francisco, be sure to bring some cash. $20 per person per establishment is usually plenty; any more than that and the establishment usually accepts credit cards.

June 14, 2016

Most of the labs by appointment at WWDC fill up in only a few seconds. Don't just be at your computer at 7 AM: also know exactly what you want. Also, using a real computer and a faster Internet connection will give you a slight advantage.

June 13, 2016

Most of the third party meet-ups at WWDC require registration because the venues have limited space. If you plan to go to a meet-up, register. Don't wait until you get there.

June 12, 2016

You may optionally bring your computer to the Keynote at WWDC. Immediately afterward, you'll have an opportunity to obtain developer previews. You need not utilize this opportunity, however; opportunities will present themselves throughout the week at the Moscone Center.

June 12, 2016

To get your badge at WWDC, you need at least some sort of valid, state-issued ID, and it speeds things up if you have your WWDC ticket on your phone. The 10 pounds of aluminum and silicon you have in your backpack... yea, you didn't need that. Also, unlike your state-issued ID, your backpack actually gets heavier the longer you stand in line.

June 11, 2016

Arriving at WWDC: It took me 2 hours to touchdown at San Francisco International Airport, claim my luggage, and take the BART to Powell Street, walk to my hotel, and check in.