Skip to content

Instantly share code, notes, and snippets.

@diarcastro
Forked from chris-sev/setup.sh
Last active February 14, 2025 22:12
Show Gist options
  • Select an option

  • Save diarcastro/942d2895a50036eef54df42777e8dfd6 to your computer and use it in GitHub Desktop.

Select an option

Save diarcastro/942d2895a50036eef54df42777e8dfd6 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
#!/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/HEAD/install.sh)"
fi
# Install Homebrew Packages
cd ~
echo "Installing Homebrew packages"
homebrew_packages=(
"git"
"nvm"
"yarn"
"zsh"
"zsh-autosuggestions"
"zsh-syntax-highlighting"
"github/gh/gh"
"hub"
"wget"
"gifski"
"nss"
"starship"
"eza"
# Install ddev and Colima
"orbstack"
"docker"
"colima"
"ddev/ddev/ddev"
)
for homebrew_package in "${homebrew_packages[@]}"; do
brew install "$homebrew_package"
done
# mkcert -install
# Install Casks
echo "Installing Homebrew cask packages"
homebrew_cask_packages=(
"google-chrome"
"phpstorm"
"insomnia"
"warp"
"obs"
"postman"
"slack"
"spotify"
"visual-studio-code"
"zoom"
"firefox"
"microsoft-edge"
"arc"
"lastpass"
"1password"
"sourcetree"
"sublime-text"
"vlc"
"gifski"
"clipy"
"microsoft-teams"
)
# Apps in mac store
# amphetamine
# easyres
# magnet
# keynote
# CopyLess 2
# apps in setapp (check your setapps favorites list)
# bartender
# sip (color picker)
# instacal
# paste
# mission control plus
# yoink
# slidepad
# install n (https://github.com/tj/n)
# make sure you follow steps here to take control of /usr folders
for homebrew_cask_package in "${homebrew_cask_packages[@]}"; do
brew install "$homebrew_cask_package" --cask
done
# configure git
git config --global user.name "Diego Castro"
git config --global user.email "[email protected]"
# Install Composer
echo "Installing Composer"
# curl -sS https://getcomposer.org/installer | php
# mv composer.phar /usr/local/bin/composer
# Create projects directory called batcave
echo "Creating a projects folder"
mkdir -p ~/projects
# zsh and oh-my-zsh
echo "Adding ZSH"
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
export ZSH_CUSTOM=~/.oh-my-zsh
git clone https://github.com/agkozak/zsh-z $ZSH_CUSTOM/plugins/zsh-z
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions
# zsh configuration
touch ~/.my-zshrc
# aliases
echo "alias push='git push'" >> ~/.my-zshrc
echo "alias pull='git pull'" >> ~/.my-zshrc
echo "alias add='git add -A'" >> ~/.my-zshrc
echo "alias commit='git commit -m'" >> ~/.my-zshrc
echo "alias status='git status'" >> ~/.my-zshrc
echo "alias checkout='git checkout'" >> ~/.my-zshrc
echo "alias merge='git merge'" >> ~/.my-zshrc
echo "alias clean='git clean -f -d'" >> ~/.my-zshrc
echo "alias reset='git reset --hard'" >> ~/.my-zshrc
echo "alias nope='git reset --hard'" >> ~/.my-zshrc
echo "alias y='yarn'" >> ~/.my-zshrc
echo "alias ys='yarn start'" >> ~/.my-zshrc
echo "alias clone='git clone'" >> ~/.my-zshrc
echo "" >> ~/.my-zshrc
echo "eval \"$(starship init zsh)\"" >> ~/.my-zshrc
echo "lsa='eza --all --icons --grid --long --classify --header'" >> ~/.my-zshrc
echo "" >> ~/.my-zshrc
# Some alias to jump between directories
echo "alias ..=\"cd ..\"" >> ~/.my-zshrc
echo "alias ..2=\"cd ../..\"" >> ~/.my-zshrc
echo "alias ..3=\"cd ../../..\"" >> ~/.my-zshrc
echo "alias ..4=\"cd ../../../..\"" >> ~/.my-zshrc
echo "alias ..5=\"cd ../../../../..\"" >> ~/.my-zshrc
# zsh plugins
# TODOD: Verify these paths
echo "plugins=(git zsh-completions zsh-z)" >> ~/.my-zshrc
echo "source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ~/.my-zshrc
echo "source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.my-zshrc
echo "export NVM_DIR=\"$HOME/.nvm\"" >> ~/.my-zshrc
echo "[ -s \"$NVM_DIR/nvm.sh\" ] && \. \"$NVM_DIR/nvm.sh\" # This loads nvm" >> ~/.my-zshrc
echo "[ -s \"$NVM_DIR/bash_completion\" ] && \. \"$NVM_DIR/bash_completion\" # This loads nvm bash_completion" >> ~/.my-zshrc
# add our zshrc config to the main zshrc config
echo "source $HOME/.my-zshrc" >> ~/.zshrc
# Refresh the ~/.my-zshrc config in current terminal
source ~/.zshrc;
# NVM Configuration
# Set default node version to the latest lts
nvm alias default lts/*
echo "lts/*" >> ~/.nvmrc
nvm install --lts
autoload -U compinit && compinit
# Change some macOs Configuration
# Show path bar
defaults write com.apple.finder ShowPathbar -bool true
# Show status bar
defaults write com.apple.finder ShowStatusBar -bool true
# Increase mouse speed
defaults write -g com.apple.mouse.scaling 5.0
# Complete
echo "Installation Complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment