It's time to tear into that shiny new Mac and write some code! Here's how I spend my first couple hours with a new machine.
Getting a new Mac is such an exciting process! Sometimes I leave the box sitting on my table for a few days, just to let the anticipation of unboxing it build (is that weird?).
I usually let the just-arrived, unopened Mac box sit on the kitchen table for a few days. Just to let the anticipation of unboxing it build.
Is that weird?
— Sean C Davis (@seancdavis29)
When I finally boot up the machine for the first time, it's still several hours before I'm actually writing code. That's because I really like using the new computer as an opportunity to clean some of the junk I don't need and haven't touched in awhile. I start fresh every time.
But I inevitably forget to do something necessary during the process — like remembering how to get messages from my phone to show up in the Messages app — and I end up frustrated and feeling like I'm wasting time.
I get a new machine every two or three years, which feels like not frequently enough to script this process. But it's enough to want a reference to what I've done in the past.
That's the purpose of this guide. This is a reference largely to serve future me in helping me setup a new Mac developer machine. But I hope you can get something out of it, too!
Setup Apple ID. Adding an Apple ID and connecting it to the computer's primary user is prompted automatically when booting up the machine for the first time.
Remove unused Apple services. I use Apple apps sparingly. I tend to find those from other developers more beneficial to my workflow. Therefore, I go into System Preferences > Apple ID and disable the following services:
That means the only ones that should be enabled are:
Delete unwanted Apple apps. At the time of writing this, the only ones I've been able to delete are Garage Band and iMovie.
Adjust dock settings. I like to adjust for the dock to not be visible unless I hover over the bottom of the screen. And the magnification animation is ... well it's fun. These settings are in System Preferences > Dock & Menu Bar.
(Touch Bar machines only) Remove Siri from the touch bar. It's possible that nothing in this world makes me angrier than unintentionally prompting Siri.
Remove magical spelling things. I like to know when I've spelled something wrong, but I do not like when words or characters are changed automatically. So I go to System Preferences > Keyboard > Text tab and remove all smart options. I also do this as necessary in other text-editing apps, like Notes and Bear.
On my most recent machine I chose to have messages sync to iCloud. This enables previous messages to appear on a new machine, rather than starting from scratch.
I also don't use Apple Contacts. I prefer to use my Google account to manage my contacts. It's syncs better across all the services I use (email, in particular).
I have found that I can move faster through Finder with a few adjustments.
,) > General tab and choose my home directory for the New Finder windows show setting.
.to toggle viewing hidden files and folders. I like to see them.
The command line is where the fun really begins! This is the foundation for pretty much everything else we'll do in this guide.
Choose to open Terminal with Rosetta. This is because the most recent machine I purchased was in the early days of the Apple M1 chip. Rosetta is kind of like a compatibility mode. I tried installing all this without Rosetta and ran into too many issues.
To open Terminal with Rosetta, navigate in Finder to your Applications directory. Then navigate to Utilities and highlight Terminal. Hit
i to bring up the Info panel. (Or secondary click and choose Get Info.) Check Open using Rosetta.
This will likely prompt a download of Rosetta. Go ahead and finish that process.
And if Terminal was previously open, quit it before continuing.
$ xcode-select --install
$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
PATH. If using ZSH, this is likely the command you'll want to run:
$ echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> ~/.zshrc
workspace. I used to call it
code. I've also seen others call it
sites. Run this command (or similar):
$ mkdir ~/workspace
Homebrew has this concept of casks, which is a super awesome way to install applications and avoid going to each website individually.
The command looks like this:
$ brew install --cask [item]
For my particular setup, I installed each of the following applications. You may want a different set.
Note that you can chain these together in a single command. But if one fails, you'll have to find out where you are and pick up where it failed.
These items I've been able to install in the past, but did not work when running Terminal with Rosetta. I had to download them separately from their respective websites.
There's more to install with Homebrew. The programs in this section are not casks and some require extra effort after installation. They get installed without the
$ brew install [item]
Those that didn't require any extra work, at least initially were:
I installed three services, which means I have to start them after they've been installed. Install with:
$ brew install redis postgresql firstname.lastname@example.org
v5.7 because it was purchased by Oracle, and newer versions (
v8) are proprietary.
After they are installed, you can start the services:
$ brew services start redis $ brew services start postgresql $ brew services start email@example.com
I like direnv for managing contextual environment variables. Install:
$ brew install direnv
And add the hook to your
~/.zshrc (or similar) file:
$ echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc
I use nvm for managing version of Node.js. To install:
$ brew install nvm
And then make a home directory for it.
$ mkdir ~/.nvm
And copy the necessary output to
~/.zshrc. For me this was:
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
Heroku is installed a little differently:
$ brew tap heroku/brew $ brew install heroku
Casks were not available for the following applications that I use, which are only available through the App Store and not their websites.
Here are some other applications I installed manually through their websites:
Now that all these apps are installed, it's time to get them set up.
spacebar. Do this in System Preferences > Keyboard > Shortcuts tab. Change
Esc+for left and right option keys. This is the way to delete full words. This image shows the option enabled only for the left option key.
p), typing sync and then choosing to enable Sync Setting. You'll have to sign in with either Microsoft or GitHub to enable this feature.
$ ssh-keygen -t ed25519 -C "firstname.lastname@example.org"
$ git config --global user.name "Your Name" $ git config --global user.email email@example.com
Holy smokes! I think that might be it, but it was a lot, wasn't it?
Your next step is to take a minute and do whatever you do to relax. Then start writing some code!
What did you learn from this? What do you do differently when setting up a new machine? I'd love to hear from you.
Ever find yourself holding down the Delete key on the command line? Here's a way to work faster.
Email revolutionized the way in which we communicate. But it's become annoying. Here is a new way of thinking about managing your inbox.
To minimize friction in publishing new blog content, I went through an experiment that used Notion as a publishing engine. After three months, I’m posting at a rate faster than ever before.