Last Updated: 10/6/2024

I have to set up a MacBook Pro fairly often - when starting a new job and when buying a new personal computer. I created this article back in 2015 when I got my first Mac and have been updating it ever since with whatever I need as my job evolves. I'm primarily a full-stack web developer, so most of my needs will revolve around JavaScript/Node.js.

Currently, this article has been updated to work for macOS 15 Sequoia.

Getting Started

The setup assistant will launch once you turn the computer on. Enter your language, time zone, Apple ID, and so on. The first thing you should do is update macOS to get the latest security updates and patches.

Homebrew

Install the Homebrew package manager. This will allow you to install almost any app from the command line.

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

Make sure everything is up to date.

brew update

Install Apps

Here are a few shell programs I always use:

Shell Program Purpose
git Version control

Here are some the applications I always install (GUI apps use the --cask flag in Homebrew):

Do not install Node.js through Homebrew. Use nvm (below).

Application Purpose
Visual Studio Code text editor
Google Chrome web browser
Firefox web browser
Rectangle window resizing
iTerm2 terminal
Docker development
Discord communication
Slack communication
Spotify music
Postgres database
Postman API tool
Obsidian Notes
Todoist Todos
App installation
## Shell Programs
brew install git

# GUI programs
brew install --cask \
  visual-studio-code \
  google-chrome \
  firefox \
  rectangle \
  iterm2 \
  docker \
  discord \
  slack \
  spotify \
  postgres \
  obsidian \
  todoist \

Shell

Catalina comes with zsh as the default shell. Install Oh My Zsh for sensible defaults.

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Shortcuts

You can add shortcuts to your shell by going to ~/.zshrc and using the alias keyword.

Using an M1 Mac, you might at some point need to switch between the Apple Silicon (ARM64) and AMD64 architecture. You can add these aliases to switch between them easily.

alias x86="env /usr/bin/arch -x86_64 /bin/zsh --login"
alias arm="env /usr/bin/arch -arm64 /bin/zsh --login"

Run uname -m to see arm64 or x86_64 to see the hardware that is currently running.

Node.js

Use Node Version Manager (nvm) to install Node.js. This allows you to easily switch between Node versions, which is essential.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash

Install

Install the latest version.

nvm install node

Restart terminal and run the final command.

nvm use node

Confirm that you are using the latest version of Node and npm.

node -v
npm -v

Update

For later, here's how to update nvm.

nvm install node --reinstall-packages-from=node

Change version

Here's how to switch to another version and use it.

nvm install xx.xx
nvm use xx.xx

And to set the default:

nvm alias default xx.xx

Git

The first thing you should do with Git is set your global configuration.

touch ~/.gitconfig

Input your config and create some aliases.

.gitconfig
[user]
  name   = Your Name
  email  = your_email@example.com
[github]
  user   = username
[alias]
  a      = add
  cm     = commit -m
  s      = status
  p      = push
  co     = checkout
  fp     = fetch --prune --all
  l      = log --oneline --decorate --graph
[push]
	autoSetupRemote = true

With the above aliases, I can run git s instead of git status, for example. It will also automatically set up your remote, so you can do git push on a branch without specifying the upstream origin.

SSH

Generate SSH key

You can generate an SSH key to distribute.

ssh-keygen -t ed25519 -C "your_email@example.com"

Start ssh-agent.

eval "$(ssh-agent -s)"

Add key.

ssh-add --apple-use-keychain ~/.ssh/id_ed25519

Config

Simplify the process of sshing into other boxes with your SSH config file. Create ~/.ssh/config if it does not already exist.

Add the following contents, changing the variables for any hosts that you connect to. Using the below will be the same as running ssh -i ~/.ssh/key.pem user@example.com.

~/.ssh/config
Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519

Host myssh
  HostName example.com
  User user
  IdentityFile ~/.ssh/key.pem

Now just run the alias to connect.

ssh myssh

macOS Settings

I don't like a lot of the Apple defaults so here are the things I always change.

To get the Home folder in the finder, press CMD + SHIFT + H and drag the home folder to the sidebar.

General

  • Make Google Chrome default browser

Dock

  • Automatically hide and show Dock
  • Show indicators for open applications

Keyboard

  • Key Repeat -> Fast
  • Delay Until Repeat -> Short
  • Disable "Correct spelling automatically"
  • Disable "Capitalize words automatically"
  • Disable "Add period with double-space"
  • Disable "Use smart quotes and dashes"

Security and Privacy

  • Allow apps downloaded from App Store and identified developers
  • Turn FileVault On (makes sure SSD is securely encrypted)

Sharing

  • Change computer name
  • Make sure all file sharing is disabled

Users & Groups

  • Add "Rectangle" to Login items

Defaults

A few more commands to change some defaults.

# Show Library folder
chflags nohidden ~/Library

# Show hidden files
defaults write com.apple.finder AppleShowAllFiles YES

# Show path bar
defaults write com.apple.finder ShowPathbar -bool true

# Show status bar
defaults write com.apple.finder ShowStatusBar -bool true

# Prevent left and right swipe through history in Chrome
defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false

Application Settings

Chrome

Visual Studio Code

Press CMD + SHIFT + P and click "Install code command in PATH".

Now you can use code {file} to open any file in VSCode.

View Dotfiles for keyboard shortcuts and settings

Extensions

Rectangle

  • Full Screen: CMD + SHIFT + ' (prevents messing with other commands)
  • Left Half: CMD + OPTION + LEFT
  • Right Half: CMD + OPTION + RIGHT

iTerm2

For some reason, iTerm2 does not let you use + and to tab through words in the terminal by default. I found this article to fix it: Use ⌥← and ⌥→ to jump forwards / backwards

  • Go to Profiles -> Keys:
    • Change ⌥← via "Send Escape Sequence" with b
    • Change ⌥→ via "Send Escape Sequence" with f

Conclusion

That sums it up for my current preferences on setting up a MacBook Pro. I hope it helped speed up your process or gave you ideas for the next time you're setting one up.