Setting up your Mac, the automatic way
Totally automate macOS UI configuration settings and software installation
Every few years, I buy a new Mac, and I spend quite some time to set it up to my taste. Moving the Dock, showing the Finder status bar, installing my favourite software…
It takes me hours, and while this is somewhat exciting, I feel that there is a better way. This year around, I finally updated my Intel MacBook Pro from early-2017, yes 6 years of great service, and if it wasn’t for the flickering screen issue, I would have keep it another year. It’s a great opportunity to start clean and install and configure my new Mac.
Today, I would like to share a way I installed my Mac, so you too can automate this process.
Configuring macOS: defaults write
While macOS has an amazing GUI for nearly everything, you must remember where is the setting you want to set up and with evolving version of the OS, things tend to move around or get renamed. I’m using defaults write
to configure the Finder, Dock, Safari and more from the command line.
defaults write
is a tool that allows you to modify plist file. plist files are stored in your ~/Library/
folder, where most OS and app settings are stored.
A few website can help you find the settings that are right for you, like defaults-write.com or macos-defaults.com.
# Move the Dock to the right
defaults write com.apple.dock "orientation" -string "right"
You can curate the settings that works best for you and save them in a shell file, so you can run it whenever you install a new Mac.
If you got further by using PlistBuddy, check my (upcoming) article about it.
Installing software: brew
Finding, downloading, opening, copying software to the Applications folder is one of the most boring task. Fortunately, thanks to Homebrew package manager — or brew for short. You can install free and paid software from the command line without having to go through boring repetitive steps.
I use brew
to install nearly all my software, Google Chrome, VSCode, WhatsApp, Android Studio, iTerm2, Figma…
Most of the apps will come through a cask which is a brew extension for artifacts that don’t need compilation.
# Install Google Chrome
brew install --cask google-chrome
How about alpha, beta and nightly build?
Brew helps you install unstable version as well, first you need to import the tap cask-versions
. Then you can use unstable versions like Android Studio Canary. Find the list of all software here.
# Add cask-versions repository for unstable
brew tap homebrew/cask-versions
# Install Android Studio Canary
brew install --cask android-studio-preview-canary
Fonts too!
If like me you have some favourite fonts you use for your terminal or in documents, it is also good to automate that part. The fonts are free and they include the nerd and powerline edition.
# Add the fonts repository
brew tap homebrew/cask-fonts
# Install Hack nerd edition font
brew install font-hack-nerd-font
Keeping things up-to-date
Brew is not only good at installing software, but it is also great at keeping them updated. You can request updates via the command line.
brew upgrade
I recommend running that command every month or so, you may want to consider brew autoupdate add-on.
Conclusion
We learned how to automate the setup of macOS the user interface with defaults
and install software and fonts with brew
. Find my installation script so you can get some inspiration to create your very own.
If you enjoyed this article, please hit the clap button many times! Thanks.