Christoph Nakazawa

Set up a new Mac, Fast

I just received a new Starlight M2 MacBook Air and I wanted to share scripts, apps, protips, and what hasn’t worked for me in the past when setting up a new Mac, fast.

Over the years I used many different personal and work Macs. While there are various methods to automatically migrate data like Apple’s Migration Assistant, they are usually imperfect, require a lot of manual work, and often cannot be used on corporate Macs. I prefer setting up new devices from scratch as it keeps my computers clean. It also forces me to make my setup portable which prevents the potential for data loss.

To get started setting up a new Mac, open your Terminal and run xcode-select --install and sudo xcodebuild -license in your terminal.1

Dotfiles

The first step is to log in to GitHub and set up a new SSH key via GitHub → SettingsSSH and GPG KeysNew SSH key. Most likely you’ll find yourself reading the Connecting to GitHub with SSH guide for the 100th time because you just cannot remember how to set up a new SSH key otherwise.

Once you are ready to use git locally, clone your dotfiles repository into ~/.home via git clone git@github.com:<username>/dotfiles.git .home. If you don’t have your own dotfiles repo yet, I highly recommend making one to backup your bash, fish shell, git, and other configuration. Check out all of these examples, or clone a copy of my dotfiles repo cpojer/dotfiles.

My dotfiles repo has a convenient ./bootstrap script from Zach Holman’s dotfiles repo. This script links every file ending in .symlink into your user’s root directory. I like this method as it keeps your dotfiles repository organized and easy to manage, yet it makes all your configuration available in the right places.

Package Manager: Homebrew

The next step is to install Homebrew with all binaries, apps and fonts2 to get your Mac ready for development. On your existing Mac, run brew bundle dump and then copy the resulting Brewfile to your new Mac. Here is an example Brewfile and a homebrew install script:

Brewfile

tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/core"
tap "homebrew/services"
brew "bat"
brew "diffutils"
brew "eza"
brew "fd"
brew "ffmpeg"
brew "fish"
brew "fzf"
brew "gh"
brew "gifsicle"
brew "git"
brew "git-delta"
brew "grep"
brew "jq"
brew "node"
brew "pnpm"
brew "postgresql", restart_service: true
brew "ripgrep"
brew "wget"
brew "yarn"
brew "youtube-dl"
cask "airflow"
cask "alfred"
cask "discord"
cask "disk-inventory-x"
cask "firefox"
cask "font-fira-code"
cask "font-fira-code-nerd-font"
cask "imageoptim"
cask "iterm2"
cask "obs"
cask "protonvpn"
cask "rectangle-pro"
cask "slack"
cask "sublime-text"
cask "syncalicious"
cask "transmit"
cask "visual-studio-code"
cask "vlc"
cask "whatsapp"
cask "zoom"

homebrew.sh

bash
#!/usr/bin/env bash
if test ! $(which brew); then
echo "Installing homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
brew update
brew bundle

Once done, open each app one by one to tell mac OS that you are happy to run dangerous Internet software, and log in to the ones that require logging in.


You’ll have all the subsequent apps installed on your Mac after running the above script.

Apps

Syncing Settings: Syncalicious

Syncalicious. If you have been copying my Homebrew install script, you’ll now have Syncalicious installed already. With Syncalicious you can backup the preferences for any of your apps. This is a great way to avoid having to keep two computers side-by-side and going through the setting screen of each app to mirror your setup exactly the way you like it. However, keep in mind that Syncalicious is still alpha software, and Mackup might be a better fit for you.

Syncalicious Screenshot

Right now, Syncalicious keeps preferences on a per-machine basis and you’ll manually have to locate your synced preferences in your Dropbox folder and copy them to ~/Library/Preferences. However, after this (and a restart) my new Mac is usually ready to go with the same setup as my previous one!


The rest of this blog post is focused on apps and protips:

Window Management: Rectangle Pro

Rectangle Pro. I tried many window management apps in the past and didn’t like most of them. Some have obscure keyboard shortcuts or feel slow. A long time ago, I discovered “Zooom2” which had two great features:

  • Moving and resizing windows using a keyboard shortcut together with the touchpad/mouse.
  • Snapping and resizing windows when dragging them to the edge of the screen.

Unfortunately, Zooom2 was frequently broken by major macOS updates and has been discontinued. I used BetterTouchTool for a few years to replicate the same behavior. However, I found it to be overly complex, it crashed frequently, and I wasn’t using most of its features, all the while it kept asking me to pay for upgrades frequently. macOS has since added a gesture to drag windows using the cursor and ⌃ control + ⌘ command that can be enabled by running defaults write -g NSWindowShouldDragOnGesture -bool true, but it does not offer a gesture for resizing.

Enter Rectangle (Pro). The free version itself won my heart quickly, but the Rectangle Pro version is 💯% worth it. Not only does it support the ability to drag and resize windows using a keyboard shortcut and the cursor it also has a convenient feature to “throw” windows into various directions to maximize or arrange them. Check out how “throwing” windows with the cursor and ⌃ control + ⌘ command works:

Screenshots: CleanShot X

CleanShot X. This app was recommended to me in response to this blog post and I have exclusively used it for screenshots and screen captures since. I was skeptical, thinkin the inbuilt screenshot and QuickTime’s recording features are sufficient, but CleanShot ties them together nicely, and improves upon them. I’m also using it’s annotation features on images from other sources, it’s great!

CleanShot X Screenshot

Spotlight Replacement: Alfred

Alfred. I have only recently started using Alfred again because I wanted a fuzzy file-search feature (in Finder) that feels native to macOS which Alfred implements using the ' prefix. I didn’t like the idea of using Spotlight and Alfred side-by-side, but you can overwrite the keyboard shortcut for Spotlight by disabling Spotlight in System PreferencesKeyboardShortcutsSpotlight. Then you can map command ⌘ + space to Alfred in the Alfred settings. Excellent!

Alfred Screenshot

A lot of people are using Raycast, which is another good choice but it feels slower than Alfred.

Casting to TV: Airflow

Airflow. I’ve tried various apps to cast to an AirPlay-compatible TV, and Airflow has always worked the best for me.3

Airflow Screenshot

Pack/unpack archives: Archiver

Archiver. I have always loved this app made in 🇦🇹 Austria for extracting archives. It has a beautiful and simple user interface/experience.

Archiver Screenshot

Filesystem Analysis: Disk Inventory X

Disk Inventory X. It’s an older app, but it checks out! A free app that makes it easy to visualize what’s taking up space on your Mac. Especially useful if you have a small hard drive.

Disk Inventory X Screenshot

To open this app for the first time you most likely have to navigate to /Applications, ⌘ command + right click and tap Open to bypass the security dialog because the app isn’t signed properly.

VPN: ProtonVPN

ProtonVPN. If you need a VPN, I’ve found ProtonVPN to be a great choice. I love their “Quick Connect” feature which you can use to map a specific type of VPN connection to a single press of a button.

ProtonVPN Screenshot

I’m currently evaluating ProtonMail, and am hoping that Proton will release a desktop application for Proton Drive in the future.

Password Manager: Proton Pass

I was a happy customer of 1Password for 10 years but the switch to a subscription-based model and breaking 1Password 6 for M1/M2 users left a sour taste in my mouth. The 1Password 8 rewrite regressed performance and introduced noticeable bugs at every key interaction that weren’t addressed for months. I’m excited that Proton launched a password manager, Proton Pass which handles all the workflows I need, without the bugs.

Protips

Text replacements

How often have you typed your email address on your phone or your Mac? Or your credit card number? In System PreferencesKeyboardText you can define custom text replacements that work system-wide.

Keyboard Shortcuts Screenshot

I usually map @@ to my email address and @card to my credit card number. I also like auto-replacing certain characters like -> to :

German Keyboard Layouts and option+space

If you are using a German or other European keyboard layouts, you are likely using the ⌥ option-key to type symbols while programming. If you are typing quickly, you might end up accidentally hitting ⌥ option and space together which inserts a non-breaking space. Nowadays VS Code will highlight such characters (and when using JavaScript, prettier will automatically remove them), but it can still be annoying.

You can avoid this by creating a file ~/Library/KeyBindings/DefaultKeyBinding.dict and dropping this into it:

{
"~ " = ("insertText:", " ");
}

Tap every “Tip”-Notification at least once.

When you set up a new Mac or iPhone, the “Tips” app will continuously nag you to learn more about your new Mac. Other apps might notify you to try out new features, and sometimes these things tend to get more aggressive when you ignore them. I have found that quickly jumping into any tutorial and hitting the “Next” button until the end is a good way to get rid of these sorts of notifications.

Remove status bar icons.

If you can’t figure out how to get rid of a specific status bar icon, you can use ⌘ command + drag&drop to get rid of them:


I drafted this blog post on my old laptop while I set up the new one. It took me about two hours until I could seamlessly transition from working on my blog inside of VS Code from one laptop to the other. The above install scripts, given a fast Internet connection, should take no more than 15 minutes to run. Most of the actual time spent was the sort of speed-run you do when you have to log into all the apps, services and websites.

Check out the second part of this post: Setting up the Perfect Development Environment.

Footnotes

  1. Xcode install was slow. At one point it told me it would take 53 hours 😅

  2. Yes! Homebrew does fonts these days!

  3. Short of just plugging my MacBook directly into the TV.

Tweet about this article, or share it with your friends. Thank you for reading, and have a great day!

Check out Athena Crisis

Athena Crisis

Ready for Another Post?

Subscribe for More