Setting up a new Macbook
December 20, 2021
Table of Contents
So you just got your shiny sparkly new Macbook for work (or maybe it’s your own personal machine)! It’s so exciting booting it up for the first time! And then… ah crap, I have to set up all my favorite things the way I prefer them… what was it I did for that one thing last time…?
A number of years back I ran across an awesome article by Tania Rascia where she documented what she does when she sets up a new Macbook (https://www.taniarascia.com/setting-up-a-brand-new-mac-for-development) and it was SO HELPFUL! So here I’m going to do the same thing and list out all of the things I like to do on my machine. At a minimum this will be super handy each time I need to set up a new machine and hopefully someone out there may find it useful for themselves as well (I hope you do)!
1. CLI stuff
homebrew
Install and update:
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
$ brew update
iTerm2
Download iTerm2 from here: https://iterm2.com
I’ll cover configuring later in the “2. Config and Setup” section.
git
Install with homebrew:
$ brew install git
Then verify the installation:
$ git --version
nvm
I like to use nvm to manage multiple versions of node. Check with your team to see what they use. If they prefer to use something else then there may be some extra work needed to get the tools working in harmony together.
Check here for the latest installation instructions: https://github.com/nvm-sh/nvm#installing-and-updating
nodenv
Many teams may use nodenv instead of nvm for managing node versions per repository. In my experience so far these two don’t play totally smoothly together but
can be made to work with some extra finagling.
First use homebrew to install:
$ brew install nodenv
for updating run:
$ brew upgrade nodenv node-build
Here’s the steps I’ve taken to make nodenv work harmoniously with nvm (if you know of a better way let me know!):
-
after both
nvmandnodenvare installed, add a symlink of the nodenv/versionsdirectory to the nvm installs of node versions:$ ln -s ~/.nvm/versions/node ~/.nodenv/versions -
verify everything has been set up correctly for nodenv
$ curl -fsSL https://github.com/nodenv/nodenv-installer/raw/master/bin/nodenv-doctor | bash
You should see something like this showing that nodenv recognizes the versions installed by nvm:
Checking for `nodenv' in PATH: /usr/local/bin/nodenv
Checking for nodenv shims in PATH: OK
Checking `nodenv install' support: /usr/local/bin/nodenv-install (node-build 4.9.64)
Counting installed Node versions: 2 versions
Auditing installed plugins: OK
From this point on you should be able to continue to use nvm to install and manage node versions.
NOTE: you may need to symlink version directories as nodenv may look for a version name without the prepended ‘v’ (eg: nodenv wants 14.16.1 and nvm has v14.16.1 installed), so this should be done:
$ cd ~/.nodenv/versions
$ ln -s ./v14.16.1 ./14.16.1
2. Config and Setup
ssh key
-
create the directory and config file if they don’t already exist
$ mkdir ~/.ssh && touch ~/.ssh/config -
Follow instructions here for generating the key: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
-
Follow instructions here for adding the key to GitHub: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account
check out my dotfiles repo
I’ve started storing and versioning my dotfiles and some other files and settings that I always use on every machine in a git repo. In the past when I knew I’d be ending a job I’d make copies of all those dotfiles and configurations in my Google Drive and then I’d have to copy them down when I got the new machine. Managing them was a pain and it was even worse if there was something really important that I forgot to make a backup of. But over the past number of years there’s been a movement to backup these valuable files in version control and there are tools to make it easy!
I followed this article to get started: https://www.anishathalye.com/2014/08/03/managing-your-dotfiles
See more about Dotbot usage here: https://github.com/anishathalye/dotbot
Now that I have Dotbot set up and everything in a git repo all I have to do is:
- check out repo
- cd inside repo
- run
./install
If I need to add a new file or directory I’ll put it in my dotfiles directory and then symlink it to
my user directory. And then periodically as I make changes to these files I’ll just git commit and git push.
.zshrc
My .zshrc is one of those dotfiles that I’ll have stored and just checked out from git.
So the first thing I’ll do is scan for anything I added specifically for the previous job that may no longer apply and remove it.
Everything else I always use will already be there ready for me.
POWERLEVEL10K
I love customizing my terminal and for that I use POWERLEVEL10K.
My config should already be saved in my dotfiles but the recommended fonts will need to be downloaded.
Follow the instructions here to download and install the recommended fonts: https://github.com/romkatv/powerlevel10k#fonts
download and set theme for iTerm2
I use a custom profile location in my iTerm2 so that I can back up my configuration in my dotfiles repo.
You can set the custom profile location by:
- Go to Preferences > General and then the Preferences tab
- Check the checkbox stating “Load preferences from a custom folder or URL”
- Browse or enter the location of my checked out
dotfilesdirectory
I like to use custom color schemes and you can find a plethora of them here: https://iterm2colorschemes.com/
3. Apps
The following is a list of all the apps I use pretty consistently and want to download and install immediately:
- Chrome
- Canary
- Firefox
- Sizzy
- Docker
- Spotify
- alfred
- SwitchResX
- DataGrip
- 1Password
- Slack
- Zoom
- VSCode (make sure sync is turned on)
- DevUtils
- Shottr
- Rectangle
- Notion
- Loom