Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 53 additions & 26 deletions setup-mac4dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,39 @@ log_error() {
echo -e "${RED}[ERROR]${NC} $1"
}

# Helper function to install cask only if not already installed
install_cask_if_missing() {
local cask_name=$1
local app_name=${2:-$cask_name} # Optional app name in /Applications, defaults to cask_name

# Check if already installed via Homebrew
if brew list --cask "$cask_name" &>/dev/null; then
log_info "$cask_name is already installed via Homebrew, skipping..."
return 0
fi

# Check if app exists in /Applications (common app names)
local app_paths=(
"/Applications/${app_name}.app"
"/Applications/${app_name//-/.}.app" # Replace hyphens with dots
"/Applications/${app_name//-/ }.app" # Replace hyphens with spaces
)

for app_path in "${app_paths[@]}"; do
if [ -d "$app_path" ]; then
log_info "$app_name is already installed in Applications, skipping..."
return 0
fi
done

# Not installed, proceed with installation
log_info "Installing $cask_name..."
if ! brew install --cask "$cask_name"; then
log_error "Failed to install cask: $cask_name"
return 1
fi
}

# Check if running on macOS
if [[ "$OSTYPE" != "darwin"* ]]; then
log_error "This script is designed for macOS only"
Expand Down Expand Up @@ -104,10 +137,10 @@ log_info "Tip: Use 'npx' to run tools without global installation (e.g., 'npx ty
log_info "Installing code editors..."

# Visual Studio Code
brew install --cask visual-studio-code
install_cask_if_missing "visual-studio-code" "Visual Studio Code"

# Cursor (AI-powered IDE)
brew install --cask cursor
install_cask_if_missing "cursor" "Cursor"

log_success "Code editors installed"

Expand Down Expand Up @@ -174,7 +207,7 @@ fi
log_info "Installing containerization tools..."

# OrbStack (recommended - faster and lighter than Docker Desktop)
brew install --cask orbstack
install_cask_if_missing "orbstack" "OrbStack"

# Docker CLI tools
brew install docker
Expand All @@ -191,13 +224,13 @@ log_warning "Launch OrbStack from Applications to complete setup."
log_info "Installing database clients..."

# TablePlus - Universal database client
brew install --cask tableplus
install_cask_if_missing "tableplus" "TablePlus"

# DBeaver - Free alternative
brew install --cask dbeaver-community
install_cask_if_missing "dbeaver-community" "DBeaver"

# MongoDB Compass - Official MongoDB GUI
brew install --cask mongodb-compass
install_cask_if_missing "mongodb-compass" "MongoDB Compass"

# PostgreSQL and MongoDB CLI tools
brew install postgresql@15
Expand All @@ -212,8 +245,8 @@ log_success "Database clients installed"
# =============================================================================
log_info "Installing communication tools..."

brew install --cask slack
brew install --cask zoom
install_cask_if_missing "slack" "Slack"
install_cask_if_missing "zoom" "zoom.us"

log_success "Communication tools installed"

Expand All @@ -222,9 +255,9 @@ log_success "Communication tools installed"
# =============================================================================
log_info "Installing browsers..."

brew install --cask brave-browser
brew install --cask google-chrome
brew install --cask firefox
install_cask_if_missing "brave-browser" "Brave Browser"
install_cask_if_missing "google-chrome" "Google Chrome"
install_cask_if_missing "firefox" "Firefox"

log_success "Browsers installed"

Expand All @@ -234,17 +267,12 @@ log_success "Browsers installed"
log_info "Installing iTerm2 and fonts..."

# iTerm2
if brew list --cask iterm2 &>/dev/null || [ -d "/Applications/iTerm.app" ]; then
echo "iTerm2 is already installed, skipping..."
else
echo "Installing iTerm2..."
brew install --cask iterm2
fi
install_cask_if_missing "iterm2" "iTerm"
# Install Nerd Fonts
# brew tap homebrew/cask-fonts
brew install --cask font-fira-code-nerd-font
brew install --cask font-jetbrains-mono-nerd-font
brew install --cask font-meslo-lg-nerd-font
# brew tap homebrew/cask-fonts
install_cask_if_missing "font-fira-code-nerd-font"
install_cask_if_missing "font-jetbrains-mono-nerd-font"
install_cask_if_missing "font-meslo-lg-nerd-font"

log_success "iTerm2 and Nerd Fonts installed"

Expand Down Expand Up @@ -458,11 +486,10 @@ style = "208 bold"

# Time
[time]
disabled = false
disabled = true
format = '🕙[\[ $time \]]($style) '
time_format = "%T"
style = "bold yellow"
disabled = true

# Command duration
[cmd_duration]
Expand Down Expand Up @@ -680,11 +707,11 @@ log_success "Neovim and AstroNvim setup complete"
log_info "Installing additional development tools..."

# API testing
brew install --cask postman
brew install --cask insomnia
install_cask_if_missing "postman" "Postman"
install_cask_if_missing "insomnia" "Insomnia"

# Version control GUI
brew install --cask sourcetree
install_cask_if_missing "sourcetree" "Sourcetree"

# File transfer
brew install wget curl
Expand Down