Created
June 27, 2026 15:16
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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