These are my configuration files and notes for setting up a new Mac.
Do the following, in this order:
- Clone this repo
- Install
oh-my-zsh
- Install Rosetta 2 (for Apple Silicon Macs)
- Install Homebrew and packages
- Set computer name
- Set up 1Password
- Sign into iCloud
- Sign into Fastmail
- Install Mac App Store apps
- Set up SSH
- Set up Node
Run git once so macOS will try to install command line tools:
git
Make directory and clone
mkdir ~/Code && git clone https://github.com/expandrew/dotfiles ~/Code/dotfiles
Copy git configuration
cp ~/Code/dotfiles/.gitconfig ~/.gitconfig
cp ~/Code/dotfiles/.gitignore_global ~/.gitignore_global
(There's a VS Code task to do this in tasks.json: π» Update Mac: git)
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Copy zsh configuration
cp ~/Code/dotfiles/.zshrc ~/.zshrc
(There's a VS Code task to do this in tasks.json: π» Update Mac: zshrc)
sudo softwareupdate --install-rosetta
Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Get brew
in the PATH for now:
eval "$(/opt/homebrew/bin/brew shellenv)"
Install everything from Brewfile, except Mac App Store apps - mas
won't work yet, because I haven't signed into iCloud at this point - this has a dependency on 1Password step to get the password, so we'll re-run brew bundle
again below after 1Password and iCloud are set up.
cd ~/code/dotfiles && brew bundle
Details for using Homebrew with multiple accounts
If there are multiple user accounts on the same Mac, I need to follow a few extra steps:
- Open System Preferences > Users & Groups
- Create a new group called
brew
; add all the users to it - Run these steps:
% sudo chgrp -R brew $(brew --prefix) # Change group to brew for Homebrew
% sudo chmod -R g+w $(brew --prefix) # Allow group members to write inside this directory
% brew doctor # Make sure everything is good
Even with this "shared group" setup, I still run into permissions issues sometimes when running brew bundle
.
Usually I can resolve it by changing ownership to the current user for the Homebrew folder:
% sudo chown -R $USER $(brew --prefix)
% brew bundle # Try installing again
Details for updating Brewfile
This is how I update the Brewfile when I install/uninstall something:
% cd ~/code/dotfiles && brew bundle dump -f
# Then commit the changes to this repo, etc.
I just do this periodically and commit it, it's not automated but the command handles the file for me so I don't have to handwrite it
(There's a VS Code task to do this in tasks.json: π Update Brewfile)
Set the computer name from System Preferences > Sharing.
Set up using the camera/phone thing via mobile app. Use Yubikey for MFA.
Sign into iCloud now that 1Password is set up. Use discretion for which "Apps using iCloud" to enable, but ensure the following are enabled:
- Photos
- iCloud Drive
- iCloud Mail
- Passwords & Keychain
- Messages in iCloud
- Find My Mac
- Reminders
- Safari
- Phone & FaceTime
- Raycast
Set up a symlink for iCloud Drive at ~/iCloud
:
ln -s ~/Library/Mobile\ Documents/com\~apple\~CloudDocs ~/iCloud
Create a new App Password for Fastmail at Settings > Password & Security > Third Party Apps > App Passwords > New App Password.
Once it's created, download the profile with the link it provides, and open System Preferences > Profile and install it.
After setting up 1Password and iCloud above, run the Homebrew install step again to install Mac App Store apps.
cd ~/code/dotfiles && brew bundle # The `mas` steps should complete now that we're signed into iCloud
Enable the 1Password SSH Agent:
- Open the 1Password app and choose 1Password > Settings from the menu bar, then select Developer.
- Select Set Up SSH Agent
Install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
Close and reopen the terminal, then install the lastest available version of Node:
nvm install node