Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Mac Setup Scripts
# More Mac setup at
# Log file
timestamp=$(date +%s)
# if true is passed in, things will reinstall
beginInstallation() {
echo "Starting installation for $1..." | tee -a $logFile
installComplete() {
echo "Installation complete for $1.\n\n\n" | tee -a $logFile
# List of applications to install via brew
declare -a brewApps=("dark-mode" "git" "gpg" "postgresql" "pyenv" "rbenv")
# List of applications to install via brew cask
declare -a brewCaskApps=("alfred" "brave" "docker" "dropbox" "firefox-developer-edition" "fish" "figma" "flux" "font-fira-code" "fork" "google-chrome" "google-chrome-canary" "iterm2" "licecap" "keybase" "ngrok" "nordvpn" "now" "onyx" "microsoft-office" "postgres" "postman" "sketch" "slack" "spectacle" "spotify" "the-unarchiver" "vanilla" "visual-studio-code-insiders" "vlc")
# Global node packages to install
declare -a globalNodePackages=("npm@latest" "yarn" "yo" "fkill" "alfred-fkill")
# List of applications to start right away
declare -a appsToStartRightAway=("Alfred 3" "Dropbox" "Flux" "Spectacle" "Vanilla")
# Make the auto-hide time to reveal the doc a very large number.
echo "Ghetto removal of the Mac dock." | tee -a $logFile
defaults write autohide-time-modifier -int 300;
killall Dock;
echo "Putting back setting Subpixel antialiasing for text in MacOS Mojave" | tee -a $logFile
defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO
echo "Setting correct permissions on folders that brew needs acccess to."
sudo chown -R `whoami`:admin /usr/local/bin
sudo chown -R `whoami`:admin /usr/local/share
# Install applications
echo "Installing applications. You may be prompted at certain points to provide your password." | tee -a $logFile
command -v brew >/dev/null 2>&1 || {
beginInstallation "Homebrew"
/usr/bin/ruby -e "$(curl -fsSL"
installComplete "Homebrew"
beginInstallation "Homebrew Cask"
brew tap caskroom/cask
installComplete "Homebrew Cask"
} | tee -a $logFile
echo "Setting up some brew tap stuff for fonts and some applications" | tee -a $logFile
brew tap caskroom/versions | tee -a $logFile
brew tap caskroom/fonts | tee -a $logFile
echo "Finished setting up some brew tap stuff for fonts and some applications" | tee -a $logFile
beginInstallation "nvm (Node version management)" | tee -a $logFile
export NVM_DIR="$HOME/.nvm"
if [ $reinstall=true ]; then
echo "Uninstalling nvm before reinstalling n." | tee -a $logFile
[ -d $NVM_DIR ] && rm -rf $NVM_DIR | tee -a $logFile
mkdir $NVM_DIR
curl -o- | bash | tee -a $logFile
[ -s "$NVM_DIR/" ] && \. "$NVM_DIR/" # This loads nvm
echo "Installing LTS version of node."
nvm install --lts
beginInstallation "Installing global node packages" | tee -a $logFile
npm i -g "${globalNodePackages[@]}" | tee -a $logFile
installComplete "Finished installing global node packages." | tee -a $logFile
for appName in "${brewApps[@]}"
beginInstallation $appName | tee -a $logFile
if [ $reinstall=true ]; then
brew reinstall $appName | tee -a $logFile
brew install $appName | tee -a $logFile
installComplete $appName | tee -a $logFile
for appName in "${brewCaskApps[@]}"
beginInstallation $appName | tee -a $logFile
if [ $reinstall=true ]; then
brew cask reinstall $appName | tee -a $logFile
brew cask install $appName | tee -a $logFile
installComplete $appName | tee -a $logFile
# Install Fisherman
beginInstallation "Fisherman" | tee -a $logFile
curl -Lo ~/.config/fish/functions/ --create-dirs | tee -a $logFile
installComplete "Fisherman" | tee -a $logFile
echo "Done installing applications" | tee -a $logFile
echo "\n\n\n" | tee -a $logFile
echo "Just a few final touches..." | tee -a $logFile
# Check to see if fish shell is already a defined shell
echo "Making fish your default shell" | tee -a $logFile
if grep -Fxq "/usr/local/bin/fish" /etc/shells
echo "Fish is already defined in the list of available shells." | tee -a $logFile
echo /usr/local/bin/fish | sudo tee -a /etc/shells | tee -a $logFile
chsh -s /usr/local/bin/fish | tee -a $logFile
echo "Fish shell is now the default shell. Logout and log back in for it to take effect." | tee -a $logFile
echo "\n\n\n"
echo "Starting applications that are used for the Desktop" | tee -a $logFile
for appName in "${appsToStartRightAway[@]}"
echo "Starting $appName..." | tee -a $logFile
open -a "$appName" | tee -a $logFile
echo "A setup log is available at $logFile."
set -U fish_user_paths $NVM_DIR fish_user_paths
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.