Skip to content

Instantly share code, notes, and snippets.

@ojoaldato
Created June 27, 2026 15:16
Show Gist options
  • Select an option

  • Save ojoaldato/b0ecf4a121d9a5f66a2a866169a2ea0a to your computer and use it in GitHub Desktop.

Select an option

Save ojoaldato/b0ecf4a121d9a5f66a2a866169a2ea0a to your computer and use it in GitHub Desktop.
Mac + Warp + zsh + Oh My Zsh setup. Install: curl -fsSL https://gist.githubusercontent.com/ojoaldato/b0ecf4a121d9a5f66a2a866169a2ea0a/raw/setup-mac-warp-zsh.sh -o setup-mac-warp-zsh.sh && chmod +x setup-mac-warp-zsh.sh && ./setup-mac-warp-zsh.sh
#!/usr/bin/env bash
set -euo pipefail
echo "πŸ‘ Setting up Mac + Warp + zsh + Oh My Zsh..."
# -------------------------------------------------------------------
# Homebrew
# -------------------------------------------------------------------
if ! command -v brew >/dev/null 2>&1; then
echo "❌ Homebrew is not installed."
echo "Install it from https://brew.sh, then rerun this script."
exit 1
fi
echo "βœ… Homebrew found"
# -------------------------------------------------------------------
# Core CLI tools
# -------------------------------------------------------------------
echo "πŸ“¦ Installing CLI tools..."
brew install \
zsh-autocomplete \
zsh-syntax-highlighting \
starship \
fzf \
ripgrep \
fd \
bat \
eza \
jq \
tree \
gh
# -------------------------------------------------------------------
# Oh My Zsh
# -------------------------------------------------------------------
if [ ! -d "$HOME/.oh-my-zsh" ]; then
echo "πŸ“¦ Installing Oh My Zsh..."
RUNZSH=no CHSH=no KEEP_ZSHRC=yes \
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
else
echo "βœ… Oh My Zsh already installed"
fi
# -------------------------------------------------------------------
# Backup .zshrc
# -------------------------------------------------------------------
if [ -f "$HOME/.zshrc" ]; then
cp "$HOME/.zshrc" "$HOME/.zshrc.backup.$(date +%Y%m%d%H%M%S)"
echo "βœ… Backed up existing ~/.zshrc"
fi
# -------------------------------------------------------------------
# Safe append helper
# -------------------------------------------------------------------
append_if_missing() {
local marker="$1"
local content="$2"
if ! grep -q "$marker" "$HOME/.zshrc" 2>/dev/null; then
printf "\n%s\n" "$content" >> "$HOME/.zshrc"
echo "βœ… Added $marker"
else
echo "βœ… $marker already present"
fi
}
# -------------------------------------------------------------------
# zsh config
# -------------------------------------------------------------------
append_if_missing "MANU_MAC_WARP_ZSH_SETUP" '
# -------------------------------------------------------------------
# MANU_MAC_WARP_ZSH_SETUP
# Mac + Warp + zsh + Oh My Zsh setup
# -------------------------------------------------------------------
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="robbyrussell"
plugins=(
git
)
source "$ZSH/oh-my-zsh.sh"
# Homebrew zsh completions
if command -v brew >/dev/null 2>&1; then
FPATH="$(brew --prefix)/share/zsh/site-functions:$FPATH"
autoload -Uz compinit
compinit
fi
# zsh autocomplete
if [ -f "$(brew --prefix)/share/zsh-autocomplete/zsh-autocomplete.plugin.zsh" ]; then
source "$(brew --prefix)/share/zsh-autocomplete/zsh-autocomplete.plugin.zsh"
fi
# fzf
if command -v fzf >/dev/null 2>&1; then
eval "$(fzf --zsh)"
fi
# Better defaults
if command -v eza >/dev/null 2>&1; then
alias ls="eza --icons"
alias ll="eza -la --icons"
alias la="eza -la --icons"
# Size-sorted long listing.
# Do not use ls -lahSz here because ls is aliased to eza and eza does not support -z.
alias l="eza -lah --sort=size --icons"
else
alias l="command ls -lahS"
fi
if command -v bat >/dev/null 2>&1; then
alias cat="bat"
fi
# Useful aliases
alias reload="source ~/.zshrc"
alias zshconfig="$EDITOR ~/.zshrc"
# Starship prompt
if command -v starship >/dev/null 2>&1; then
eval "$(starship init zsh)"
fi
# Syntax highlighting should stay near the end
if [ -f "$(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ]; then
source "$(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
fi
# -------------------------------------------------------------------
# END MANU_MAC_WARP_ZSH_SETUP
# -------------------------------------------------------------------
'
# -------------------------------------------------------------------
# Validation
# -------------------------------------------------------------------
echo ""
echo "πŸ”Ž Validating setup..."
echo ""
zsh -ic '
echo "shell: $SHELL"
echo "zsh: $ZSH_VERSION"
echo ""
missing=0
check_cmd() {
if command -v "$1" >/dev/null 2>&1; then
echo "βœ… $1: $(command -v "$1")"
else
echo "❌ missing: $1"
missing=1
fi
}
for cmd in brew starship fzf rg fd bat eza jq tree gh; do
check_cmd "$cmd"
done
echo ""
echo "aliases:"
alias ls 2>/dev/null || echo "❌ ls alias missing"
alias ll 2>/dev/null || echo "❌ ll alias missing"
alias la 2>/dev/null || echo "❌ la alias missing"
alias l 2>/dev/null || echo "❌ l alias missing"
alias cat 2>/dev/null || echo "❌ cat alias missing"
echo ""
echo "zshrc config:"
grep -q "MANU_MAC_WARP_ZSH_SETUP" ~/.zshrc && echo "βœ… setup block in ~/.zshrc" || echo "❌ setup block missing"
grep -q "starship init zsh" ~/.zshrc && echo "βœ… starship in ~/.zshrc" || echo "❌ starship missing from ~/.zshrc"
grep -q "fzf --zsh" ~/.zshrc && echo "βœ… fzf in ~/.zshrc" || echo "❌ fzf missing from ~/.zshrc"
grep -q "zsh-autocomplete" ~/.zshrc && echo "βœ… zsh-autocomplete in ~/.zshrc" || echo "❌ zsh-autocomplete missing from ~/.zshrc"
grep -q "zsh-syntax-highlighting" ~/.zshrc && echo "βœ… syntax highlighting in ~/.zshrc" || echo "❌ syntax highlighting missing from ~/.zshrc"
grep -q "alias l=\"eza -lah --sort=size --icons\"" ~/.zshrc && echo "βœ… l alias uses eza size sort" || echo "⚠️ l alias may be using fallback or custom value"
echo ""
if (( missing == 0 )); then
echo "πŸ‘ All peachy."
else
echo "⚠️ Some tools are missing."
fi
'
echo ""
echo "βœ… Done. Restart Warp or run:"
echo "source ~/.zshrc"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment