Setting up macOS for development
Update : As of the 20/04/2022, I’m no longer installing most my development environment in the same way, I’ve made this post explaining my transition to development containers.
With each release of macOS, I clean install everything on my MacBook just to be extra safe and avoid long debugging hours if there is an incompatibility. Thus this guide is about setting up your machine quickly and in a predictable way.
I’m primarily doing ML but I also set up various environnements, so feel free to be selective while reading this guide. I removed a lot of very specific things to make a good balance between development and general macOS usage.
Initial formatting steps
When everything you care about is backed up you can proceed with pressing CMD⌘+R on startup. Then go to Disk Utility, format your drive with APFS and install macOS.
Complete the initial set up with your Apple ID and choose your privacy preferences, you should now be on the desktop.
Homebrew, Zsh & Other Mac settings
Homebrew is the most popular macOS package manager, we will use it to install all our apps (except mas ones because it doesn’t work anymore)
In your terminal let’s copy & paste to install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then let’s make sure everything is up to date:
brew update && brew upgrade
You can now install your apps, or search for it on the Homebrew website:
# Note: you can install multiple apps in just one line, but this is a better visualization# Below the "--cask" refers to graphical applications instead of formulae.# Browsersbrew install --cask firefoxbrew install --cask firefox-developer-editionbrew install --cask google-chromebrew install --cask homebrew/cask-versions/google-chrome-dev# Media playersbrew install --cask iinabrew install --cask vlc# File downloads and disk analyzebrew install --cask transmissionbrew install --cask grandperspective# Media transcodebrew install --cask handbrake# Flash images (to USB for example)brew install --cask balenaetcher# Developmentbrew install --cask visual-studio-codebrew install --cask dockerbrew install --cask localbrew install --cask cyberduckbrew install --cask tower# App cleanerbrew install --cask appcleaner# Remote communicationbrew install --cask zoombrew install --cask discord# Vpnbrew install --cask private-internet-access# Keyboard based window managementbrew install --cask rectangle# Markdown writerbrew install --cask obsidian
Here are some formulae, make sure to understand each software that you install before trusting a random internet guide:
# Logitech Options softwarebrew install homebrew/cask-drivers/logitech-options# Developmentbrew install docker-composebrew install nodebrew install htopbrew install gitbrew install tree# Pythonbrew install pyenv# Shellbrew install romkatv/powerlevel10k/powerlevel10kbrew install zsh-autosuggestionsbrew install zsh-syntax-highlightingbrew install zsh-history-substring-search
We can now configure Python:
pyenv install 3.9.7pyenv global 3.9.7echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.zshrc
To finish the powerlevel10k and zsh setup we need the following:
# Pluginsecho "source $(brew --prefix)/opt/powerlevel10k/powerlevel10k.zsh-theme" >>~/.zshrcecho "source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh" >>~/.zshrcecho "source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >>~/.zshrcecho "source /usr/local/share/zsh-history-substring-search/zsh-history-substring-search.zsh" >>~/.zshrc
# Zsh tweaksecho -e "autoload -Uz compinit" >>~/.zshrcecho -e "compinit" >>~/.zshrcecho -e "zstyle ':completion:*' menu select" >>~/.zshrc# Key bindings for history searching, the order is importantecho -e "bindkey '^[[A' history-substring-search-up" >>~/.zshrcecho -e "bindkey '^[[B' history-substring-search-down" >>~/.zshrc
# Note: lines below are my personal aliases, this might disturb your workflowecho -e "alias c='clear'" >>~/.zshrcecho -e "alias rmm='rm -rf'" >>~/.zshrcecho -e "alias lss='ls -lah'" >>~/.zshrcecho -e "alias edit='code ~/.zshrc'" >>~/.zshrcecho -e "alias reload='source ~/.zshrc'" >>~/.zshrc
We also need to configure git basics properly :
git config --global user.email "YOUR_EMAIL"git config --global user.name "YOUR_NAME"
macOS is better with some tweaks:
# Note: There are a lot of settings that you could change, this is just a few of them that I use# Always show file extensionsdefaults write NSGlobalDomain AppleShowAllExtensions -bool true# Show status bar in Finderdefaults write com.apple.finder ShowStatusBar -bool true# Allow text selection in Quick Lookdefaults write com.apple.finder QLEnableTextSelection -bool true# Disable TimeMachine promptdefaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true# This is needed to apply our changeskillAll Finder
Finally before closing the terminal I setup powerlevel10k:
# Note: This has already been installed in the fomulae section above, this is just the installsource ~/.zshrc
Everthing else
Once this is done I usually login into my password manager, retreive software licences, ssh keys and proceed to login to some applications like Google Chrome, Discord, etc.
Here is everything I changed in the System Preferences app
- General > Enable Dark Mode
- Desktop > Live wallpaper selection
- Desktop > Screensaver > Hot Corners > Bottom Left > CMD⌘ + Display sleep
- Dock > Enable Automatically hide
- Siri > Disable show Siri in menu bar
- Notifications > Disable everything or remove sounds
- Screen Time > Enable & share across devices
- Security > General > Require password > Immediately
- Trackpad > More Gestures > Enable everything
- Sharing > Setup the computer name
- iCloud > iCloud Drive > Enable Desktop & Document
- Keyboard > Text > Disable spelling and capitalization
Some Mac App Store apps that I use
- 1Password (Password Manager)
- Xcode (Code apps)
- Amphetamine (Keep Mac awake)
- Adguard (Safari ad disable)
- The Unarchiver (Almost unrar for Mac)
- Parcel (Track packages)
Conclusion
This was a quick look at how I install macOS, I hope this helped you in your next fresh install.
If you enjoyed this guide you can also check the previous ones about iCloud custom domains or Cloudflare argo & access on a RaspberryPi.