Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions .zshenv
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,9 @@ export REPORTTIME=3
export CLICOLOR=1
export LSCOLORS="exfxcxdxbxGxDxabagacad"
export LS_COLORS="di=34:ln=35:so=32:pi=33:ex=31:bd=36;01:cd=33;01"

##########################################################################
# ALIAS
##########################################################################

alias ls="eza --icons --git --time-style relative -al"
83 changes: 83 additions & 0 deletions src/macos/Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# =============================================================================
# Brewfile - macOS Development Environment Package Definitions
# =============================================================================
# Location: src/macos/Brewfile
# Usage:
# brew bundle --file=src/macos/Brewfile # Install packages
# brew bundle dump --file=src/macos/Brewfile # Update this file
# =============================================================================

tap "homebrew/bundle"

# =============================================================================
# Essential Development Tools
# =============================================================================
brew "git" # Version control
brew "gh" # GitHub CLI
brew "node" # JavaScript runtime
brew "powerlevel10k" # Zsh theme

# =============================================================================
# Command Line Utilities
# =============================================================================
brew "cmake" # Build system
brew "eza" # Better ls with icons
brew "fastfetch" # System info display
brew "jq" # JSON processor
brew "glances" # System monitor

# =============================================================================
# Python Environment
# =============================================================================
brew "pipx" # Isolated Python packages
brew "uv" # Fast Python package manager

# =============================================================================
# Media & File Processing
# =============================================================================
brew "ffmpeg" # Video/audio processing
brew "imagemagick" # Image manipulation
brew "yt-dlp" # Media downloader

# =============================================================================
# Development Applications
# =============================================================================
cask "visual-studio-code" # Primary code editor
cask "docker" # Containerization platform
cask "github" # GitHub desktop client
cask "ghostty" # GPU-accelerated terminal

# =============================================================================
# Web Browsers
# =============================================================================
cask "google-chrome" # Primary browser
cask "firefox" # Alternative browser

# =============================================================================
# Productivity & Utilities
# =============================================================================
cask "claude" # AI assistant desktop app
cask "alt-tab" # Window switcher
cask "clibor" # Clipboard manager
cask "popclip" # Text selection actions
cask "logi-options+" # Logitech device settings

# =============================================================================
# Creative Applications
# =============================================================================
cask "blender" # 3D modeling and animation

# =============================================================================
# VS Code Extensions
# =============================================================================
vscode "anthropic.claude-code" # Claude Code integration
vscode "github.copilot" # GitHub Copilot
vscode "github.copilot-chat" # Copilot chat interface
vscode "ms-python.python" # Python language support
vscode "ms-python.vscode-pylance" # Python IntelliSense
vscode "ms-python.debugpy" # Python debugger
vscode "docker.docker" # Docker support
vscode "ms-azuretools.vscode-docker" # Azure Docker tools
vscode "ms-azuretools.vscode-containers" # Container development
vscode "ms-vscode-remote.remote-containers" # Remote container development
vscode "james-yu.latex-workshop" # LaTeX support
217 changes: 213 additions & 4 deletions src/macos/install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,213 @@
# ZSH
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.zsh/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
git clone https://github.com/marlonrichert/zsh-autocomplete.git ~/.zsh/zsh-autocomplete
#!/bin/bash

# =============================================================================
# Automated macOS Development Environment Setup Script
# =============================================================================
# This script sets up a complete development environment using:
# - Homebrew for package management
# - Brewfile for declarative package installation
# - Dotfiles symlink management
# - Zsh plugins installation
# =============================================================================

set -e # Exit on any error

# Color codes for better output readability
readonly RED='\033[0;31m'
readonly GREEN='\033[0;32m'
readonly YELLOW='\033[1;33m'
readonly BLUE='\033[0;34m'
readonly BOLD='\033[1m'
readonly NC='\033[0m'

# Configuration
readonly DOTFILES_DIR="$HOME/Documents/GitHub/dotfiles"
readonly BACKUP_DIR="$HOME/.dotfiles_backup_$(date +%Y%m%d_%H%M%S)"

# =============================================================================
# Helper Functions
# =============================================================================

print_header() {
echo -e "\n${BOLD}${BLUE}=== $1 ===${NC}\n"
}

print_success() {
echo -e "${GREEN}✅ $1${NC}"
}

print_error() {
echo -e "${RED}❌ $1${NC}"
}

print_warning() {
echo -e "${YELLOW}⚠️ $1${NC}"
}

print_info() {
echo -e "${BLUE}ℹ️ $1${NC}"
}

# =============================================================================
# Main Installation Functions
# =============================================================================

install_homebrew() {
print_header "Homebrew Installation"

if command -v brew &> /dev/null; then
print_success "Homebrew already installed"
print_info "Updating Homebrew..."
brew update
else
print_info "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
print_success "Homebrew installed successfully"
fi
}

install_packages() {
print_header "Package Installation via Brewfile"

local brewfile_path="$DOTFILES_DIR/src/macos/Brewfile"

if [ -f "$brewfile_path" ]; then
print_info "Installing packages from Brewfile..."
brew bundle --file="$brewfile_path" --no-lock
print_success "All packages installed successfully"
else
print_warning "Brewfile not found at $brewfile_path, skipping package installation"
fi
}

setup_directories() {
print_header "Directory Setup"

print_info "Creating necessary directories..."
mkdir -p ~/.zsh
mkdir -p ~/.config
mkdir -p "$BACKUP_DIR"

print_success "Directories created"
}

install_zsh_plugins() {
print_header "Zsh Plugins Installation"

local plugins=(
"zsh-users/zsh-syntax-highlighting:~/.zsh/zsh-syntax-highlighting"
"zsh-users/zsh-autosuggestions:~/.zsh/zsh-autosuggestions"
"marlonrichert/zsh-autocomplete:~/.zsh/zsh-autocomplete"
)

for plugin in "${plugins[@]}"; do
local repo="${plugin%%:*}"
local path="${plugin##*:}"
local name=$(basename "$path")

if [ ! -d "$path" ]; then
print_info "Installing $name..."
git clone "https://github.com/$repo.git" "$path"
print_success "$name installed"
else
print_warning "$name already exists, updating..."
(cd "$path" && git pull)
fi
done
}

create_symlinks() {
print_header "Dotfiles Symlink Creation"

local dotfiles=(".zshrc" ".zshenv" ".vimrc" ".gitconfig")

for file in "${dotfiles[@]}"; do
local source_file="$DOTFILES_DIR/$file"
local target_file="$HOME/$file"

# Backup existing file if it exists and isn't a symlink
if [ -f "$target_file" ] && [ ! -L "$target_file" ]; then
print_warning "Backing up existing $file"
mv "$target_file" "$BACKUP_DIR/"
fi

# Create symlink if source exists
if [ -f "$source_file" ]; then
ln -sf "$source_file" "$target_file"
print_success "Linked $file"
else
print_warning "Source file $source_file not found"
fi
done
}

configure_shell() {
print_header "Shell Configuration"

local current_shell=$(basename "$SHELL")

if [ "$current_shell" != "zsh" ]; then
print_info "Setting Zsh as default shell..."
local zsh_path=$(which zsh)

if ! grep -q "$zsh_path" /etc/shells; then
print_info "Adding Zsh to /etc/shells..."
echo "$zsh_path" | sudo tee -a /etc/shells
fi

chsh -s "$zsh_path"
print_success "Zsh set as default shell"
else
print_success "Zsh is already the default shell"
fi
}

setup_fzf() {
print_header "FZF Configuration"

if command -v fzf &> /dev/null; then
print_info "Setting up FZF key bindings..."
$(brew --prefix)/opt/fzf/install --key-bindings --completion --no-update-rc
print_success "FZF configured"
else
print_warning "FZF not found, skipping configuration"
fi
}

cleanup_and_finish() {
print_header "Cleanup and Final Steps"

# Remove empty backup directory
if [ -d "$BACKUP_DIR" ] && [ ! "$(ls -A "$BACKUP_DIR")" ]; then
rmdir "$BACKUP_DIR"
print_info "Empty backup directory removed"
elif [ -d "$BACKUP_DIR" ]; then
print_info "Original files backed up to: $BACKUP_DIR"
fi

print_success "🎉 Setup completed successfully!"
print_info "Please restart your terminal or run 'source ~/.zshrc' to apply changes"
}

# =============================================================================
# Main Execution
# =============================================================================

main() {
echo -e "${BOLD}${GREEN}"
echo "🚀 Starting Automated Development Environment Setup"
echo "=================================================="
echo -e "${NC}"

install_homebrew
install_packages
setup_directories
install_zsh_plugins
create_symlinks
configure_shell
setup_fzf
cleanup_and_finish
}

# Execute main function
main "$@"