Skip to content

One-command macOS dev environment setup & maintenance

License

Notifications You must be signed in to change notification settings

26zl/MacOS-Dev-Setup

Repository files navigation

macOS Development Environment Setup

Checks Security Scan macOS Test License: MIT

One-command setup for a complete macOS development environment with automated tool management.

Terminal preview

Quick Start

One-liner install:

curl -fsSL https://raw.githubusercontent.com/26zl/MacOS-Dev-Setup/main/bootstrap.sh | zsh

Or clone manually:

git clone https://github.com/26zl/MacOS-Dev-Setup.git
cd MacOS-Dev-Setup
./install.sh        # Installs shell setup and system package managers
./dev-tools.sh      # Installs language tools (optional)
source ~/.zshrc

Daily usage:

update    # Update all tools
verify    # Check status
versions  # Show versions
upgrade   # Update the setup scripts themselves
install   # Re-run base system setup
dev-tools # Re-run dev tools installer

Features

  • One Command Updates: Update Homebrew, Python, Node.js, Ruby, Rust, Go, Swift, .NET, and more
  • Beautiful Terminal: Powerlevel10k, syntax highlighting, autosuggestions
  • Safe & Smart: Protects system files, graceful error handling
  • Multi-Language: Python (pyenv), Node.js (nvm), Ruby (chruby), Rust (rustup), Swift (swiftly), Go, Java, .NET
  • CI/CD Safe: Non-interactive mode support

Installation

Basic Setup

./install.sh
source ~/.zshrc

Installs: Xcode CLT, Git, Homebrew, Oh My Zsh, Powerlevel10k, ZSH plugins, maintain-system script

Optional: MacPorts, mas, Nix, FZF (interactive prompts)

Development Tools

./dev-tools.sh          # Interactive installation
./dev-tools.sh check    # Dry-run
./dev-tools.sh test     # Test detection

Installs: Conda, pipx, pyenv, nvm, chruby, rustup, swiftly, Go, Java, .NET

Usage

Commands

  • update - Update all tools, package managers, and language runtimes
  • verify - Check status of all installed tools
  • versions - Display versions of all tools
  • upgrade - Update the setup scripts from the latest GitHub release
  • install - Re-run the base system setup (Homebrew, Oh My Zsh, etc.)
  • dev-tools - Re-run the dev tools installer (Python, Node.js, Rust, etc.)

What Gets Updated

Package Managers: Homebrew, MacPorts, Nix, mas, Conda, pipx

Languages: Python (pyenv), Node.js (nvm), Ruby (chruby), Rust (rustup), Swift (swiftly), Go, Java, .NET

Global Packages: npm, Cargo, Go tools, Python packages, RubyGems

Note: Only global/system packages are updated. Project files (package.json, go.mod, etc.) are never modified.

Configuration

Environment variables:

  • MAINTAIN_SYSTEM_CLEAN_PYENV=0 - Disable Python cleanup
  • MAINTAIN_SYSTEM_CLEAN_NVM=0 - Disable Node.js cleanup
  • MAINTAIN_SYSTEM_CLEAN_CHRUBY=0 - Disable Ruby cleanup
  • MAINTAIN_SYSTEM_PYENV_KEEP="3.11.8,3.10.14" - Keep specific Python versions
  • MAINTAIN_SYSTEM_NVM_KEEP="v18.19.1" - Keep specific Node.js versions
  • MAINTAIN_SYSTEM_CHRUBY_KEEP="ruby-3.4.6" - Keep specific Ruby versions
  • MAINTAIN_SYSTEM_SWIFT_SNAPSHOTS=1 - Enable Swift snapshots
  • MACOS_DEV_SETUP_UPDATE_CHECK=0 - Disable update notifications on shell start

Supported Tools

Package Managers: Homebrew, MacPorts, Nix, mas, Conda, pipx

Languages: Python (pyenv), Node.js (nvm), Ruby (chruby), Rust (rustup), Swift (swiftly), Go, Java, .NET

Databases: MySQL, MongoDB, PostgreSQL (detection only)

Other: Docker, C/C++ (via Xcode CLT)

Terminal

Pre-configured with Oh My Zsh, Powerlevel10k, syntax highlighting, autosuggestions, and FZF.

Ghostty Setup (Optional)

brew install --cask ghostty
mkdir -p ~/.config/ghostty
cp "Ghostty config.txt" ~/.config/ghostty/config
cp background/terminal-background.png ~/.config/ghostty/terminal-background.png

FAQ

Will this modify my project files? No! Only global/system packages are updated. Project files are never modified.

Is it safe for CI/CD? Yes! Set NONINTERACTIVE=1 or CI=1 for automated runs.

Does it work on Intel and Apple Silicon? Yes! Automatically detects architecture.

What if tools are missing? The update command gracefully skips missing tools and shows installation instructions.

Compatibility

Requirement Details
macOS macOS 13 Ventura or later (may work on older versions)
Architecture Apple Silicon (M1/M2/M3/M4/M5) and Intel x86_64
Shell Zsh (default on macOS since Catalina)
Disk space ~15-30GB free (Xcode CLT + Homebrew + dev tools)
Network Required for all installations (downloads from GitHub, Homebrew, etc.)
Permissions Some optional tools (MacPorts, Nix) require sudo

Security

  • Input validation and sanitization
  • Selective error handling
  • Safe directory navigation
  • HTTPS-only downloads with TLS verification

Note: Scripts download external content. Review scripts before running for maximum security.

Contributing

  1. Run ./quick-test.sh to verify syntax
  2. Ensure ShellCheck passes
  3. Test on both Intel and Apple Silicon Macs

CI/CD: ShellCheck, Gitleaks, Trivy, syntax checks, comprehensive macOS tests.

License

MIT License - see LICENSE file for details.


If this project helped you, please consider giving it a star!

GitHub stars GitHub forks