Skip to content

Instantly share code, notes, and snippets.

@chris-sev
Last active November 26, 2024 16:59
Show Gist options
  • Save chris-sev/45a92f4356eaf4d68519d396ef42dd99 to your computer and use it in GitHub Desktop.
Save chris-sev/45a92f4356eaf4d68519d396ef42dd99 to your computer and use it in GitHub Desktop.
Mac Setup
# how to run this thingy
# create a file on your mac called setup.sh
# run it from terminal with: sh setup.sh
# heavily inspired by https://twitter.com/damcclean
# https://github.com/damcclean/dotfiles/blob/master/install.sh
# faster dock hiding/showing (run in terminal)
# defaults write com.apple.dock autohide-delay -float 0; defaults write com.apple.dock autohide-time-modifier -int 0;killall Dock
# add dock spacer
# defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}' && killall Dock
#!/bin/bash
set -euo pipefail
# Display message 'Setting up your Mac...'
echo "Setting up your Mac..."
sudo -v
# Homebrew - Installation
echo "Installing Homebrew"
if test ! $(which brew); then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
fi
# Install Homebrew Packages
cd ~
echo "Installing Homebrew packages"
homebrew_packages=(
# "git" - installed with xcode
"node"
"n"
# "php" - i install php through herd.laravel.com now
# "composer" - installed through herd.laravel
)
for homebrew_package in "${homebrew_packages[@]}"; do
brew install "$homebrew_package"
done
# make sure composer global packages is in your PATH. example:
# export PATH=~/.composer/vendor/bin:$PATH
# Install Casks
echo "Installing Homebrew cask packages"
homebrew_cask_packages=(
"arc"
"cursor"
"descript"
"discord"
"github"
"notion"
"notion-calendar"
"raycast"
"screenflow"
"screen-studio"
"setapp"
"slack"
"spotify"
# "quitter" - replaced by raycast's auto-quit feature
"visual-studio-code"
"warp"
)
# other apps
# https://herd.laravel.com
# https://stuntsoftware.com/reflex/ - route play/pause to spotify
# https://www.flowvoice.ai/ - voice transcription
# https://www.homerow.app/ - like vim for your computer
# https://superhuman.com/ - super fast email
# apps in mac app store
# bear
# perplexity
# final cut pro
# apps in setapp (check your setapps favorites list)
# bartender
# cleanshot
# cleanmymac
# dato
# numi
# session
# swish
# yoink
# tableplus
# xsnapper
# fonts
# geist mono - https://vercel.com/font
for homebrew_cask_package in "${homebrew_cask_packages[@]}"; do
brew install --cask "$homebrew_cask_package"
done
# oh-my-zsh
echo "Adding Oh my zsh"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# aliases
echo "alias ni='npm i'" >> ~/.zshrc
echo "alias ns='npm start'" >> ~/.zshrc
echo "alias nb='npm run build'" >> ~/.zshrc
echo "alias nd='npm run dev'" >> ~/.zshrc
echo "alias a='php artisan'" >> ~/.zshrc
# configure git
git config --global user.name "Chris Sev"
git config --global user.email "[email protected]"
# Create projects directory called batcave
echo "Creating a Batcave directory"
mkdir -p $HOME/documents/batcave
# Generate SSH key
echo "Generating SSH keys"
ssh-keygen -t rsa
echo "Copied SSH key to clipboard - You can now add it to Github"
pbcopy < ~/.ssh/id_rsa.pub
# Complete
echo "Installation Complete"
@Kunoacc
Copy link

Kunoacc commented Jul 6, 2020

🔥

@andreiverdes
Copy link

Loving line 126!

@shahbaz17
Copy link

Awesome!

Thanks Chris for sharing.

@JimCMorrison
Copy link

This was super helpful in rebuilding my new Mac :) I adjusted where needed. Thanks again!

@eosfelipe
Copy link

beautiful

@tylerhammer
Copy link

tylerhammer commented Oct 7, 2020

@chris-on-code, I mentioned this on Discord, but it looks like the ZSH installation can interrupt the script. I was able to work by this by converting lines 123 and 124 to the following:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
git clone https://github.com/agkozak/zsh-z ~/.oh-my-zsh/custom/plugins/zsh-z

This was added in ohmyzsh/ohmyzsh#5169
You can't use the $ZSH_CUSTOM when you use --unattended as it doesn't bring you into ZSH.

This allowed the rest of the script to complete, and then on reboot of terminal after the script, you go through the PowerLevel10K.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment