Skip to site navigation
Go home

Lee Reamsnyder

Setting up a new M1 Mac for web development

2022 Nov 6 16 min read Published by Lee Reamsnyder Permalink

This week I started a new job, and with it came a new MacBook Pro that I had to set up from scratch.

I’ve done this plenty of times and I always forget something. So this time, I finally remembered to write down all the steps necessary to get a new Mac functional for me.

I’m sharing my setup steps because I’ve learned a bunch from others describing their setups.

See something nonsensical or that I could be doing better? Let me know!

Before we dive in, if this is replacing an existing Mac, I strongly recommend using Migration Assistant to yoink your entire existing system over. I’ve been tempted many times to start a new personal computer with a “clean slate” and I always always always regret it and spend far too much time trying to get things set up just as they were anyway and it’s a giant waste of time. Migration Assistant (right along with Quick Start) is one of Apple’s secret weapons; just use it.

If that’s not an option, read on.

Power it on

Go through the startup wizard. The defaults are sensible these days, including Filevault encryption being on by default.

If your workplace policy allows it, sign into iCloud. Heck even if you can only use some of the features or IT will kick you off it later, having instant access to your Airpods and shared iCloud keychain is a blessing, especially early on.

I’ve been bit by this before: even if this computer is replacing an existing one, do not reuse an account password from any existing Mac that is on your iCloud account; iCloud freaks out about this if you use those existing devices for 2-factor authentication.

First couple of minutes after you log in

All right we’re on the desktop now.

First thing is to install Homebrew, which we’ll use extensively going forward. Also this installs the Xcode Command Line tools for you, which you’ll probably have to do anyway if you use git. Pop open Terminal, then run the install command from the Homebrew site:

/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”

While that’s happening, drag everything out of the Dock. For a work machine, you’re probably not going to be using most of that anyway, including Mail, Calendar, Contacts, Maps, Music, FaceTime, etc. You can drag over the Dock-worthy apps as you use them.

Speaking of the Dock, fire up System Preferences:

  1. Under Dock & Menu Bar, turn on Automatically hide and show the Dock; vertical space is at a premium on a laptop screen or widescreen monitor, and you don’t need the Dock visible all the time.
  2. If your Mac has Touch ID, add a few more fingers so you have options for unlocking your computer. I like having both index fingers and my right thumb in there. While you’re in there, check everything under Use Touch ID for because it’s just too useful.
  3. Under Bluetooth, turn on Show Bluetooth in menu bar. I guess you could use Control Center for sorta fast access to Bluetooth, but my most common pressing need is to get my headphones connected now, so it’s worth taking up space in the menu. Set up any Bluetooth peripherals. I swear by the Magic Trackpad because Apple just nails trackpads and I love having a gigantic one.
  4. Speaking of headphones, under Sound, switch Show Sound in menu bar to always. This is another way to fast-switch to your Airpods, if you have them.
  5. Under Sharing, they’ve probably given you a generic default Computer Name that’s just like Lee’s MacBook; change that to something unique like Lee’s ${EMPLOYER NAME HERE} MacBook 16" or literally anything that’ll help you identify it on your network and isn’t the same as anything else so you don’t end up with Lee’s MacBook (6) or whatever.
  6. If you use BBEdit, under Settings > Keyboard > Shortcuts > Mission Control, turn off the Control + Up Mission Control shortcut as it conflicts with BBEdit’s Move Line Up command. It also blocks using Control + Up as a system-wide equivalent to Page up alongside Control + Down for Page down. I do use Mission Control, but it’s on a three-finger swipe up on the trackpad (again, love that gigantic trackpad).
  7. While you’re in Keyboard Shortcuts, go to the Spotlight sub-menu and change the command for Show Spotlight search to Command + Option + Space and disable the Show Finder search window shortcut. This frees up Command + Space for Alfred which I use extensively.
  8. Under Trackpad > Scroll & Zoom, you probably have a strong opinion about the direction that things scroll when you drag with 2 fingers. Years ago I just accepted the default Natural setting, but I know lots people think this feels so wrong.

At this point, Homebrew has probably finished up its initial install bits. Follow the instructions it spits out to add Homebrew to your shell path (and initiate it for your current window), which for me was:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

This was a strange new world for me, as I’ve been (poorly) using bash, the previous default shell application that Terminal uses, for like 15 years now. This step would have previously futzed with ~/.bash_profile, but new Macs default to the zsh shell which is kinda sorta the same thing but has different configuration files. I found this article did a good job of explaining what was going on during the Homebrew install.

Anyway, you should now be able to run the brew command, so we can finally install shit.

Get brewing

First up, get git and openssl up to date and managed by Homebrew:

brew install git openssl

If you already know some of the programming languages you’ll be using, sure, throw in ruby or kotlin or what-have-you now. I used to install node here, but now I preemptively accept that I’ll have to probably juggle a few node versions with nvm, which they don’t recommend installing with Homebrew.

Finally install some apps

Homebrew isn’t just for command line stuff! You can install and update regular apps which they call “casks” for reasons unknown. Let’s install a bunch of apps casks in one go:

brew install --cask 1password alfred dropbox bbedit caffeine divvy docker github postman spotify visual-studio-code kap soulver google-chrome firefox

Your IT person is probably wondering where the heck you are, so you should install whatever email application (outlook?) or trendy collaboration tool (slack? notion?) your work uses now too.

Set up those apps

The order matters!

1Password

You need a password manager. I use this one, specifically the Family plan with the cloud syncing.

I want this installed before setting up other applications or accounts so I can capture the login details and generate strong passwords. I also keep all my software licenses in here, so I need this to set up other apps.

Once you’re all signed in, set up a new vault for your new job to keep those compartmentalized.

Dropbox

Aaargh I just can’t quit you, Dropbox! I happily paid for it when it was a practically perfect “one folder that syncs perfectly across your devices” service; unfortunately now it’s trying to be some weird enterprise collaboration hodgepodge.

At this point I only use this for syncing application preferences for Alfred and BBEdit. I wish I could find something better for that so I could just drop this.

Alfred

I use maybe 1% of Alfred’s capabilities, but I can’t use a Mac without it at this point. I use it mostly to launch apps, execute system commands like locking the screen, expand text snippets, and most crucially juggle items in the clipboard history.

To set it up:

  1. Fire up Alfred, input my license, and go through the setup wizard so it has all the necessary permissions.

  2. Once you can launch Alfred, go to Preferences > Advanced and under Syncing, select the folder with your existing Alfred configuration.

    This will bring over most of your existing workflows, snippets, and other preferences and keep those in sync across all your ’puters; however, there’s some settings you have to swizzle for each install, which we’ll tackle next.

  3. Under General, change the Alfred Hotkey. I use Alfred constantly so I use Command + Space

  4. Under Features > Snippets, check Automatically expand snippets by keyword. This replaced TextExpander for me. I have a tasteful selection of keywords prefixed with zz that I like to have at the ready. For example, when I type zzshrug in any application, Alfred transforms that into ¯\_(ツ)_/¯. I have useful text snippets too, but that one’s the best.

  5. Under Features > Clipboard History, toggle on Keep plain text. I use Command + Option + C (think: Command + C for Copy but, like, a little more) for Viewer Hotkey to access the last pile of things I’ve copied. I use the clipboard history literally hundreds of times per day.

BBEdit

Like with Alfred, I use only a tiny fraction of BBEdit’s power, but it never lets me down for general purpose text editing, text fiddling, and find-replacing through projects of any size. I always have it open, I’ll chuck any bit of text that needs some manipulation into it, and I have never ever lost data in it. It’s so good.

I sync preferences, snippets, scripts, plugins, etc across all my computers with (ugh) Dropbox, so I just have to put in a license and everything’s all set.

The only advanced preference (which has to be set per-machine in Terminal) that I use lets you navigate between open files in visual order instead of the default alphabetical order: defaults write com.barebones.bbedit SurfNextPreviousInDisplayOrder -bool YES. Done.

Google Chrome & Firefox

I do day-to-day web development in Chrome for its excellent dev tools and also it’s like the most popular browser on the planet (it’s fine). I’ll also test or develop in Firefox sometimes as it has better CSS dev tools right now for things like CSS Grid.

In both browsers, I install the 1Password extension. Chrome gets set as my default browser for “work.” I also install the laser-focused Clear Session extension in Chrome, which one-click deletes all the cookies for the domain you’re on, an invaluable shortcut when troubleshooting, well, anything with cookies.

Visual Studio Code

VS Code has become the default editor for Web-y coding these days, especially JavaScript-heavy applications. I’m in this all day. I would probably prefer something more Mac-assed like Nova from Panic but VS Code is free and it’s hard to resist its gravity.

I won’t go deep into how I customize this because this always ends up different everywhere I work and the tools you’re using will dictate what plugins and such you install. That said, out of the box it definitely needs some work. The “Make VS Code Not Suck Awesome" course has improved my working environment in many small but meaningful ways.

And the rest…

  • docker: Odds are you’ll be using containers in some capacity.
  • caffeine: If you just need to keep your computer from going to sleep or whatever for a bit, turn this on. Your hardware security team at work will hate this.
  • divvy: This lets you quickly resize and relocate a pile of windows with keyboard shortcuts. I’m worried that it won’t be getting updates any more; there are newer utilities like Rectangle that do similar things.
  • github: This is the desktop app for GitHub, which I like to use for basics like commits and pushing branches instead of fussing with the command line. However, Visual Studio Code’s built-in git tooling has replaced most of my need for this.
  • postman: You’re probably going to be doing some REST calls, and Postman is amazing for futzing with those.
  • kap: I’ve cycled through like a dozen little apps over the years for capturing a video of some or all of your screen and spitting out a gif or whatever. This one’s free and works great. So handy for little “take a lookit this weird behavior” or “look at the feature I just finished” videos to drop into your work chat.
  • soulver: You kinda have to see this in action but it’s a text scratchpad that’s also a calculator. It’s very handy for “I am juggling some numbers but not enough to warrant like a spreadsheet” situations.
  • spotify: Music good (But I still miss you, Rdio).

Some little command line utilities that I love

I broke these out because they require some additional configuration or shell twiddling.

First up is autojump:

brew install autojump

Autojump is hard to describe, but once you have it you’ll never want to not have it. It tracks every directory you navigate to in a terminal. It then provides the j command which lets you type a few letters in a directory name, and autojump will use its data to predict the most likely directory you’re referring to (say, the most frequently accessed folders) and send you right there.

Say you have a Javascript project with client-side code, server-side code, and shared utility folders like…

/src
  /client
  /server
  /shared

Navigate to those folders a couple of times, and pretty soon you’ll be able to type j c and autojump will shoot you to the client directory; j s will take you to the most-used of shared or server; j sh will send you to shared; if there are multiple possibilities, repeating the same command will take you to the next-most-likely directory. It’s faster than cd ../server if you’re in one of the sibling directories, and way way faster to jump from, say, your ~/ root user directory to your most-accessed project directories. It’s kinda magic.

Sales pitch over. Once autojump is installed, it’ll give you a command to dump into ~/.zshrc to power it up every session. Wouldn’t you know it, BBEdit installs its own command bbedit that opens whatever file directly into BBEdit! So we bbedit ~/.zshrc, add the required lines, done.

Next up is the supremely satisfying thefuck application:

brew install thefuck

The command line is finicky, but a lot of tools will suggest how to fix your mistakes. For instance, when I’ve been working in a new branch locally in git and I want to push that up to GitHub, I type git push like a sensible person:

$ git checkout -b new-macbook-article
$ git push
Fatal: The current branch new-macbook-article has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin new-macbook-article

I mess this up all the time and I literally never learn.

But with thefuck set up, I can fix it and vent some anger at the same time! Type fuck after any botched command and it’ll try to figure out how to fix it and dump the corrected command in place for you. It works shockingly well; even when it doesn’t work, I feel a little better.

After it’s installed, you’ve gotta put something in ~/.zshrc to start it up every session. Add a line with eval $(thefuck --alias) there.

Since we’re in .zshrc anyway, I dump in these little helpers that I saw in someone else’s shared .bash_profile some time back that I can’t seem to source:

alias cp='cp -iv'                           # Preferred 'cp' implementation
alias mv='mv -iv'                           # Preferred 'mv' implementation
alias mkdir='mkdir -pv'                     # Preferred 'mkdir' implementation
alias ll='ls -FGlAhp'                       # Preferred 'ls' implementation
cd() { builtin cd "$@"; ll; }               # Always list directory contents upon 'cd'
alias cd..='cd ../'                         # Go back 1 directory level (for fast typers)
alias ..='cd ../'                           # Go back 1 directory level
alias ...='cd ../../'                       # Go back 2 directory levels
mcd () { mkdir -p "$1" && cd "$1"; }        # mcd:          Makes new Dir and jumps inside
trash () { command mv "$@" ~/.Trash ; }     # trash:        Moves a file to the MacOS trash

I use the .. (go up 1 directory) and ... (go up 2 directories) shortcuts all the time, and trash lets you recover deleted files after an oopsie, which you can’t do with rm.

Set up GitHub SSH access

A few years ago, setting up SSH access to GitHub used to be a dark art with snippets of documentation and troubleshooting information spread across the entire internet, but now GitHub’s documentation on SSH is very good, actually. Just follow that. Kudos, GitHub technical writers 👏.

Pop into the App Store

I have a few goodies from the App Store that I’ve accumulated over the years that I find very handy:

  • Yoink gives you a little shelf that sits over all your other apps to collect drag-and-drop files, so it’s way easier to shuffle files around.
  • Unarchiver vastly expands the types of compressed archive files that you can open on a Mac. And it’s free!
  • 1Password for Safari because Safari extensions are in the App Store now.

Set up Safari

I like to use Safari as a “personal” browser on a work machine so I can keep that separate from work browsing and developing. Mostly this is for iCloud tab syncing so if I start reading something at work I can pick it up later at home on another machine.

The only preferences I change here are:

  • Preferences > General > Safari opens with: All non-private windows from last session. I don’t know why this isn’t the default.
  • Preferences > Advanced > Show Develop menu in menu bar. I’m a web dork I can’t help it.

I can work now!

Yay?

Again, if you found this helpful or you see something so stupid that you can’t let it slide because nothing is more infuriating than watching people who aren’t you use computers, let me know!

← Older post Pocket Watch Person → Newer post How to work around CORS errors in JavaScript

Menu

  • Home
  • Blog
  • Work
  • Contact
  • Archives
  • Feeds: RSS | JSON

Search

Elsewhere

  • GitHub
  • Instagram
  • Mastodon
  • Twitter
© Copyright 2006–2023, Lee James Reamsnyder
Back to top