Lachlan's avatar@lachlanjc/notebook

Automate setting up new Macs

I recently erased my MacBook Pro to set it up fresh, then soon after, got a work laptop. Setting up a new Mac, with all the tools one needs as a developer, is a nontrivial process, & ripe for automation.

After being a longtime fan of the Thoughtbot Laptop project to automate installation of various development tools, I wanted to customize it. I forked the project to set up all the tools I use, enable hidden files on macOS, & then documented the manual steps I take as well. Since I continue to update that project, check out its README for an up-to-date list of what it sets up, but it includes Homebrew, Git, Node, Yarn, Ruby, & a ton of other developer tools.

My macOS setup process

  • During setup, skip Siri & Screen Time, enable all the other default settings

  • In System Preferences, turn on DND, 5:00am–4:59am (then Cmd-drag DND out of the menu bar)

  • In the Keyboard settings:

    • Modifier Keys. Remap Caps Lock to Escape
    • Customize Control Strip. Remove Siri, add Sleep
    • Shortcuts. Enable "Use keyboard navigation"
    • Input Sources. Disable "Show Input menu in menu bar"
  • Download my Laptop script & execute it:

    curl --remote-name
    sh mac 2>&1 | tee ~/laptop.log
  • In the Internet Accounts settings, add Google account

  • In the Sharing settings, set the computer name

  • In the Security & Privacy settings:

    • Enable "Use your Apple Watch to unlock"
    • Enable Zoom’s components to allow screensharing
  • Download Craft, iA Writer, Things, Drafts, Dato, & Xcode from the App Store

  • Open 1Password, sign in, enable its default settings

  • In Safari settings:

    • Enable Extensions > 1Password
    • Enable Advanced > Show full website address
    • Enable Advanced > Show Develop menu in menu bar
  • In FaceTime settings (Cmd-,), disable "Calls From iPhone"

  • In VSCode:

    • Configure Prettier as the default formatter, set its formatting settings
    • Turn up default text size
    • Disable View > Appearance > Show Activity Bar
  • Install fonts (mine are stored in iCloud Drive)

  • Set up code folders (~/src, then grouped by GitHub org)

    • mkdir src
    • cd src
    • mkdir lachlanjc
    • mkdir {OTHER_GITHUB_ORGS}
    • Add src to Finder sidebar
    • Switch Finder to Column view

Screenshot of my code folder setup in Finder

Before I factory reset my Mac

(Note: I’ve only used Intel Macs. Not sure if anything is different on M1 machines.)

  1. Back up the whole computer. (I use the Samsung T3/T5 drives, alongside ChronoSync since it verifies checksums after backing up, but I know people like SuperDuper as well. Time Machine works in a pinch, as does dragging your user folder to the drive in Finder.)
  2. Because one is none & to make it easier to bring the files you need to the new OS installation, copy the files you want to migrate to another drive as well. For me, I just dragged my code folder (~/src) to a secondary drive, since that’s what’s really valuable on my Mac. (I have some old projects that aren’t on GitHub.)