How to Setup a New Computer (Again)
I have set up a new computer at least 15 times and each time it's been like I'm doing it from scratch. But I just got a new computer and it's high time to fix this problem. I'll show you how I made this process super easy.
Checklist
Here are the goals for this project.
- Be able to do everything below by just running one command
- Have the script be re-runnable with no side effects
- Install Homebrew and associated apps
- Install Oh My Zsh
- Configure git
- Configure GitHub
- Configure Mac settings
- Install important scripts
If you just want to see the final result, check out the dotfiles repo.
Key Files
Breaking the files up will allow for better organization and easier maintenance.
curl-entry.sh
will be the entry point when calling viacurl
which will enable it to be one command to get it goinginstall.sh
will be the main script that will delegate to other scripts as needed.zshrc
will contain my standard zsh configBrewfile
will contain the list of apps to install with Homebrewsystem-preferences.sh
will contain all the Mac OSX settings I always set, like tap to click, locking desktop positions, etc..gitconfig
will contain my standard git config
Because there's a single entry point, it's super easy to run the script.
curl https://raw.githubusercontent.com/rgpass/dotfiles/main/curl-entry.sh | bash
Flow
Running the above command will do:
curl
the entry point file and pipe tobash
- Clone into a new directory and run the
install.sh
script - Configure
sudo
to only need to be entered once - Make all the directories I normally make
- Install
z
(frecent algorithm for jumping directories) - Install Oh My Zsh
- Create symlink for
.zshrc
- Install or update Homebrew
- Install all the apps in the
Brewfile
- Configure the Mac settings
- Configure git and GitHub
- Exit all apps that would need to be restarted
After it's all done, the computer will be ready to go.
Key Findings
Brewfile
's are super helpful and can be generated withbrew bundle dump
. This creates a full dump, but you probably don't want all of them- Also, you don't really need to keep dependencies versioned, so you can remove
Brewfile.lock.json