Skip to content

Instantly share code, notes, and snippets.

@trungh13
Last active April 15, 2026 10:05
Show Gist options
  • Select an option

  • Save trungh13/04eaa955e4907325191a37276fe86624 to your computer and use it in GitHub Desktop.

Select an option

Save trungh13/04eaa955e4907325191a37276fe86624 to your computer and use it in GitHub Desktop.
mac-terminal-setup-Feb-2026.sh
#!/bin/bash
# mac-terminal-setup-feb-2026.sh - Complete Terminal & Dev Environment Setup
# Interactive tool selection with preset profiles: All, Essential, or Custom
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m'
echo -e "${BLUE}═══════════════════════════════════════════════════════════════${NC}"
echo -e "${CYAN} 🚀 Modern Terminal Setup for 2026 - Enhanced Edition${NC}"
echo -e "${BLUE}═══════════════════════════════════════════════════════════════${NC}"
echo ""
# Profile selection
echo -e "${YELLOW}Choose your setup profile:${NC}"
echo ""
echo " 1) ${GREEN}All${NC} - Install everything (recommended)"
echo " 2) ${CYAN}Essential${NC} - Just the core tools"
echo " 3) ${BLUE}Custom${NC} - Pick and choose"
echo ""
read -p "Select (1-3): " profile_choice
case $profile_choice in
1) PROFILE="all" ;;
2) PROFILE="essential" ;;
3) PROFILE="custom" ;;
*) echo "Invalid choice"; exit 1 ;;
esac
echo ""
# Initialize all flags
INSTALL_STARSHIP=false
INSTALL_GHOSTTY=false
INSTALL_NERD_FONT=false
INSTALL_ZSH_SUGGESTIONS=false
INSTALL_ZSH_SYNTAX=false
INSTALL_FZF=false
INSTALL_RIPGREP=false
INSTALL_BAT=false
INSTALL_EXA=false
INSTALL_LAZYGIT=false
INSTALL_NVM=false
INSTALL_PYENV=false
INSTALL_NERD_FONT=false
CONFIGURE_GIT=false
SETUP_ZSH=false
# Function to ask yes/no
ask_yes_no() {
local prompt="$1"
local response
while true; do
read -p "$(echo -e ${YELLOW}${prompt}${NC} '(y/n): ')" response
case "$response" in
[yY][eE][sS]|[yY]) return 0 ;;
[nN][oO]|[nN]) return 1 ;;
*) echo "Please answer yes or no." ;;
esac
done
}
# Profile: All
if [ "$PROFILE" = "all" ]; then
INSTALL_STARSHIP=true
INSTALL_GHOSTTY=true
INSTALL_NERD_FONT=true
INSTALL_ZSH_SUGGESTIONS=true
INSTALL_ZSH_SYNTAX=true
INSTALL_FZF=true
INSTALL_RIPGREP=true
INSTALL_BAT=true
INSTALL_EXA=true
INSTALL_LAZYGIT=true
INSTALL_NVM=true
INSTALL_PYENV=true
CONFIGURE_GIT=true
SETUP_ZSH=true
fi
# Profile: Essential
if [ "$PROFILE" = "essential" ]; then
INSTALL_STARSHIP=true
INSTALL_GHOSTTY=true
INSTALL_NERD_FONT=true
INSTALL_ZSH_SUGGESTIONS=true
INSTALL_FZF=true
SETUP_ZSH=true
fi
# Profile: Custom
if [ "$PROFILE" = "custom" ]; then
echo -e "${BLUE}Core Tools${NC}"
ask_yes_no "Install Starship (fast shell prompt)?" && INSTALL_STARSHIP=true
ask_yes_no "Install Ghostty (GPU-accelerated terminal)?" && INSTALL_GHOSTTY=true
ask_yes_no "Install Nerd Font (FiraCode)?" && INSTALL_NERD_FONT=true
ask_yes_no "Configure Zsh?" && SETUP_ZSH=true
echo ""
echo -e "${BLUE}Zsh Enhancements${NC}"
ask_yes_no "Install zsh-autosuggestions?" && INSTALL_ZSH_SUGGESTIONS=true
ask_yes_no "Install zsh-syntax-highlighting?" && INSTALL_ZSH_SYNTAX=true
ask_yes_no "Install fzf (fuzzy finder)?" && INSTALL_FZF=true
echo ""
echo -e "${BLUE}CLI Tools${NC}"
ask_yes_no "Install ripgrep (better grep)?" && INSTALL_RIPGREP=true
ask_yes_no "Install bat (better cat)?" && INSTALL_BAT=true
ask_yes_no "Install exa (better ls)?" && INSTALL_EXA=true
ask_yes_no "Install lazygit (git UI)?" && INSTALL_LAZYGIT=true
echo ""
echo -e "${BLUE}Development${NC}"
ask_yes_no "Install nvm (Node version manager)?" && INSTALL_NVM=true
ask_yes_no "Install pyenv (Python version manager)?" && INSTALL_PYENV=true
ask_yes_no "Configure Git?" && CONFIGURE_GIT=true
fi
# Show summary
echo ""
echo -e "${BLUE}═══════════════════════════════════════════════════════════════${NC}"
echo -e "${YELLOW}Installation Summary${NC}"
echo -e "${BLUE}═══════════════════════════════════════════════════════════════${NC}"
echo ""
echo -e "${CYAN}Core:${NC}"
echo " Starship: $([ "$INSTALL_STARSHIP" = true ] && echo -e ${GREEN}'✓'${NC} || echo -e ${RED}'✗'${NC})"
echo " Ghostty: $([ "$INSTALL_GHOSTTY" = true ] && echo -e ${GREEN}'✓'${NC} || echo -e ${RED}'✗'${NC})"
echo " Nerd Font: $([ "$INSTALL_NERD_FONT" = true ] && echo -e ${GREEN}'✓'${NC} || echo -e ${RED}'✗'${NC})"
echo ""
echo -e "${CYAN}Shell:${NC}"
echo " zsh-autosuggestions: $([ "$INSTALL_ZSH_SUGGESTIONS" = true ] && echo -e ${GREEN}'✓'${NC} || echo -e ${RED}'✗'${NC})"
echo " zsh-syntax-highlighting: $([ "$INSTALL_ZSH_SYNTAX" = true ] && echo -e ${GREEN}'✓'${NC} || echo -e ${RED}'✗'${NC})"
echo " fzf: $([ "$INSTALL_FZF" = true ] && echo -e ${GREEN}'✓'${NC} || echo -e ${RED}'✗'${NC})"
echo ""
echo -e "${CYAN}CLI Tools:${NC}"
echo " ripgrep: $([ "$INSTALL_RIPGREP" = true ] && echo -e ${GREEN}'✓'${NC} || echo -e ${RED}'✗'${NC})"
echo " bat: $([ "$INSTALL_BAT" = true ] && echo -e ${GREEN}'✓'${NC} || echo -e ${RED}'✗'${NC})"
echo " exa: $([ "$INSTALL_EXA" = true ] && echo -e ${GREEN}'✓'${NC} || echo -e ${RED}'✗'${NC})"
echo " lazygit: $([ "$INSTALL_LAZYGIT" = true ] && echo -e ${GREEN}'✓'${NC} || echo -e ${RED}'✗'${NC})"
echo ""
echo -e "${CYAN}Development:${NC}"
echo " nvm: $([ "$INSTALL_NVM" = true ] && echo -e ${GREEN}'✓'${NC} || echo -e ${RED}'✗'${NC})"
echo " pyenv: $([ "$INSTALL_PYENV" = true ] && echo -e ${GREEN}'✓'${NC} || echo -e ${RED}'✗'${NC})"
echo " Git config: $([ "$CONFIGURE_GIT" = true ] && echo -e ${GREEN}'✓'${NC} || echo -e ${RED}'✗'${NC})"
echo ""
if ! ask_yes_no "Proceed with installation?"; then
echo -e "${YELLOW}Setup cancelled.${NC}"
exit 0
fi
echo ""
echo -e "${BLUE}Starting installation...${NC}"
echo ""
# Install Homebrew
if ! command -v brew &> /dev/null; then
echo -e "${YELLOW}Installing Homebrew...${NC}"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
# Core installations
if [ "$INSTALL_STARSHIP" = true ]; then
echo -e "${YELLOW}Installing Starship...${NC}"
brew install starship
echo -e "${GREEN}✓ Starship${NC}"
fi
if [ "$INSTALL_GHOSTTY" = true ]; then
echo -e "${YELLOW}Installing Ghostty...${NC}"
brew install ghostty
echo -e "${GREEN}✓ Ghostty${NC}"
fi
# Shell enhancements
if [ "$INSTALL_ZSH_SUGGESTIONS" = true ]; then
echo -e "${YELLOW}Installing zsh-autosuggestions...${NC}"
brew install zsh-autosuggestions
echo -e "${GREEN}✓ zsh-autosuggestions${NC}"
fi
if [ "$INSTALL_ZSH_SYNTAX" = true ]; then
echo -e "${YELLOW}Installing zsh-syntax-highlighting...${NC}"
brew install zsh-syntax-highlighting
echo -e "${GREEN}✓ zsh-syntax-highlighting${NC}"
fi
if [ "$INSTALL_FZF" = true ]; then
echo -e "${YELLOW}Installing fzf...${NC}"
brew install fzf
echo -e "${GREEN}✓ fzf${NC}"
fi
# CLI Tools
if [ "$INSTALL_RIPGREP" = true ]; then
echo -e "${YELLOW}Installing ripgrep...${NC}"
brew install ripgrep
echo -e "${GREEN}✓ ripgrep${NC}"
fi
if [ "$INSTALL_BAT" = true ]; then
echo -e "${YELLOW}Installing bat...${NC}"
brew install bat
echo -e "${GREEN}✓ bat${NC}"
fi
if [ "$INSTALL_EXA" = true ]; then
echo -e "${YELLOW}Installing exa...${NC}"
brew install exa
echo -e "${GREEN}✓ exa${NC}"
fi
if [ "$INSTALL_LAZYGIT" = true ]; then
echo -e "${YELLOW}Installing lazygit...${NC}"
brew install lazygit
echo -e "${GREEN}✓ lazygit${NC}"
fi
# Version managers
if [ "$INSTALL_NVM" = true ]; then
echo -e "${YELLOW}Installing nvm...${NC}"
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
echo -e "${GREEN}✓ nvm${NC}"
fi
if [ "$INSTALL_PYENV" = true ]; then
echo -e "${YELLOW}Installing pyenv...${NC}"
brew install pyenv
echo -e "${GREEN}✓ pyenv${NC}"
fi
# Create config directories
mkdir -p ~/.config/ghostty
mkdir -p ~/.config
# Configure Ghostty
if [ "$INSTALL_GHOSTTY" = true ]; then
cat > ~/.config/ghostty/config << 'EOF'
font-family = FiraCode Nerd Font
font-size = 12
background = #1e1e1e
foreground = #d4d4d4
cursor-style = block
window-padding-x = 10
window-padding-y = 10
scrollback-limit = 10000
EOF
fi
# Configure Starship
if [ "$INSTALL_STARSHIP" = true ]; then
cat > ~/.config/starship.toml << 'EOF'
"$schema" = 'https://starship.rs/config-schema.json'
format = """
[](color_orange)\
$os\
[](bg:color_yellow fg:color_orange)\
$directory\
[](fg:color_yellow bg:color_aqua)\
$git_branch\
$git_status\
[](fg:color_aqua bg:color_blue)\
$nodejs\
$python\
$rust\
$golang\
[](fg:color_blue bg:color_bg3)\
$docker_context\
[](fg:color_bg3 bg:color_bg1)\
$time\
[ ](fg:color_bg1)\
$line_break$character"""
palette = 'gruvbox_dark'
[palettes.gruvbox_dark]
color_fg0 = '#fbf1c7'
color_bg1 = '#3c3836'
color_bg3 = '#665c54'
color_blue = '#458588'
color_aqua = '#689d6a'
color_green = '#98971a'
color_orange = '#d65d0e'
color_purple = '#b16286'
color_red = '#cc241d'
color_yellow = '#d79921'
[os]
disabled = false
style = "bg:color_orange fg:color_fg0"
[os.symbols]
Macos = "󰀵"
Linux = "󰌽"
Windows = "󰍲"
[directory]
style = "fg:color_fg0 bg:color_yellow"
format = "[ $path ]($style)"
truncation_length = 3
truncation_symbol = "…/"
home_symbol = "~"
[git_branch]
symbol = ""
style = "bg:color_aqua"
format = '[[ $symbol $branch ](fg:color_fg0 bg:color_aqua)]($style)'
[git_status]
style = "bg:color_aqua"
format = '[[($all_status$ahead_behind )](fg:color_fg0 bg:color_aqua)]($style)'
[nodejs]
symbol = ""
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
[python]
symbol = ""
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
[rust]
symbol = ""
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
[golang]
symbol = ""
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'
[docker_context]
symbol = ""
style = "bg:color_bg3"
format = '[[ $symbol( $context) ](fg:#83a598 bg:color_bg3)]($style)'
[time]
disabled = false
time_format = "%R"
style = "bg:color_bg1"
format = '[[ $time ](fg:color_fg0 bg:color_bg1)]($style)'
[character]
success_symbol = '[❯](bold fg:color_green)'
error_symbol = '[❯](bold fg:color_red)'
EOF
fi
# Configure Zsh
if [ "$SETUP_ZSH" = true ]; then
if grep -q 'eval "$(starship init zsh)"' ~/.zshrc 2>/dev/null; then
echo -e "${GREEN}✓ Starship already in zshrc${NC}"
else
echo '' >> ~/.zshrc
echo '# Starship prompt' >> ~/.zshrc
echo 'eval "$(starship init zsh)"' >> ~/.zshrc
fi
# Add shell plugins
if [ "$INSTALL_ZSH_SUGGESTIONS" = true ]; then
if ! grep -q 'zsh-autosuggestions' ~/.zshrc 2>/dev/null; then
echo 'source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh' >> ~/.zshrc
fi
fi
if [ "$INSTALL_ZSH_SYNTAX" = true ]; then
if ! grep -q 'zsh-syntax-highlighting' ~/.zshrc 2>/dev/null; then
echo 'source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh' >> ~/.zshrc
fi
fi
if [ "$INSTALL_FZF" = true ]; then
if ! grep -q 'fzf' ~/.zshrc 2>/dev/null; then
echo '[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh' >> ~/.zshrc
fi
fi
echo -e "${GREEN}✓ Zsh configured${NC}"
fi
# Configure Git
if [ "$CONFIGURE_GIT" = true ]; then
echo -e "${YELLOW}Configuring Git...${NC}"
read -p "Enter your Git name: " git_name
read -p "Enter your Git email: " git_email
git config --global user.name "$git_name"
git config --global user.email "$git_email"
git config --global init.defaultBranch main
echo -e "${GREEN}✓ Git configured${NC}"
fi
# Summary
echo ""
echo -e "${BLUE}═══════════════════════════════════════════════════════════════${NC}"
echo -e "${GREEN}✓ Installation Complete!${NC}"
echo -e "${BLUE}═══════════════════════════════════════════════════════════════${NC}"
echo ""
if [ "$INSTALL_NERD_FONT" = true ]; then
echo -e "${YELLOW}Nerd Font Installation Required:${NC}"
echo " 1. Download from: https://www.nerdfonts.com/font-downloads"
echo " 2. Install FiraCode Nerd Font"
echo " 3. Or: cp ~/Downloads/FiraCode/*.ttf ~/Library/Fonts/"
echo ""
fi
echo -e "${YELLOW}Next Steps:${NC}"
echo " 1. Reload shell: exec zsh"
if [ "$INSTALL_NERD_FONT" = true ]; then
echo " 2. Set terminal font to: FiraCode Nerd Font"
fi
echo ""
echo -e "${GREEN}Your modern terminal is ready! 🚀${NC}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment