Setting up macOS

Here’s a single bash script to install your favorite apps on a freshly installed macOS. While there’s other approaches using Ansible, this bash approach works amazingly well and smooth. Remember to edit the file and to add your real name ($ME) and your e-mail address, before running this script.

#!/bin/bash

ME="Fistname Lastname"
EML="email@website.com"

git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global user.name $ME
git config --global user.email $EML
git config --global core.editor "nano"
git config --global --add --bool push.autoSetupRemote true

ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -C $ME

xcode-select --install

# bash
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >> ~/.zshrc

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

# Apps
brew install htop wget php ansible ansible-lint libsass node-sass composer gh
brew install --cask arc
brew install --cask --no-quarantine syntax-highlight
brew install symfony-cli/tap/symfony-cli
brew install --cask beekeeper-studio
brew install --cask brave-browser
brew install --cask discord
brew install --cask docker
brew install --cask figma
brew install --cask firefox
brew install --cask google-chrome
brew install --cask miro
brew install --cask postman
brew install --cask redisinsight
brew install --cask skype
brew install --cask teamviewer
brew install --cask textmate
brew install --cask visual-studio-code
brew install --cask vlc

# NVM
brew install nvm
source $(brew --prefix nvm)/nvm.sh
nvm install 18
nvm install 16
nvm install node

# Updatedb and Locate
sudo /usr/libexec/locate.updatedb
echo "alias updatedb='sudo /usr/libexec/locate.updatedb'" >> ~/.zshrc
echo "export PATH='$HOME/.composer/vendor/bin:$PATH'" >> ~/.zshrc

# Configure GitHub CLI
gh auth login

Of course this is a highly opinionated list, which you might want to adjust to your needs.

To run this script, as it is, download the file and execute it:

curl https://gist.githubusercontent.com/vardumper/f2781d52291c813fff8b26025fd6e3ed/raw/c099ef5e57e7da0998775baea80136beafb38bfe/macos-setup.sh --output ~/macos-setup.sh
# now edit name and email
sh ~/macos-setup.sh

Updating all of your applications at once is as straight forward as with any other package manager:

brew update && brew upgrade --greedy

The greedy parameter tells Brew to update all the casks as well.