#!/bin/bash # orbstack-dev-sandbox-setup.sh # ============================================================================ # OrbStack Development Sandbox Setup Script # ============================================================================ # # Creates a fully configured development environment for Claude Code with # Elixir/Erlang, browser automation, and PostgreSQL. # # REQUIREMENTS: # - macOS with Apple Silicon (ARM64) # - OrbStack installed (https://orbstack.dev) # # USAGE: # 1. Create the VM: orb create ubuntu dev-sandbox # 2. Shell into it: orb shell dev-sandbox # 3. Run this script: ./orbstack-dev-sandbox-setup.sh # # WHAT THIS INSTALLS: # - mise (version manager) # - Node.js (latest LTS) # - Erlang 28.3.1 # - Elixir 1.19.5-otp-28 # - Claude Code + plugins # - Chromium (ARM64 native, for browser automation) # - Playwright # - PostgreSQL 16 # # CONNECTING FROM macOS: # SSH: ssh dev-sandbox@orb # Zed: Cmd+Shift+P → "Open Remote Folder" → dev-sandbox@orb:~/projects # Ghostty: ssh dev-sandbox@orb # VS Code: Remote-SSH → dev-sandbox@orb # Files: /Volumes/OrbStack/dev-sandbox/home// # # POSTGRESQL: # The script creates a superuser matching your Linux username and a 'dev' database. # # From inside VM: # psql dev # Connect to dev database # psql -l # List databases # createdb myapp_dev # Create new database # # From macOS: # psql -h dev-sandbox.orb.local -U -d dev #` # Connection string for Elixir/Phoenix: # postgres://@dev-sandbox.orb.local/myapp_dev # # DBeaver connection (from macOS): # Host: dev-sandbox.orb.local # Port: 5432 # Database: dev # User: # Password: (leave blank, uses peer auth over SSH) # # Or use SSH tunnel in DBeaver: # SSH Host: dev-sandbox@orb # SSH Auth: Use your macOS SSH key # # CLAUDE CODE PLUGINS INSTALLED: # From anthropics/claude-code marketplace: # - code-review Multi-agent PR review with confidence scoring # - code-simplifier Cleans up verbose AI-generated code # - feature-dev 7-phase feature development workflow # - pr-review-toolkit Specialized review agents # - security-guidance Security monitoring hook # - frontend-design UI/UX design guidance skill # # From obra/superpowers marketplace: # - double-shot-latte Stops "Would you like me to continue?" interruptions # - elements-of-style Writing guidance based on Strunk's classic # - superpowers Core superpowers functionality # - superpowers-chrome Browser automation via Chrome DevTools Protocol # - superpowers-lab Experimental/in-development skills # # MCP SERVERS: # - playwright Browser automation and screenshots # - superpowers-chrome Direct Chrome/Chromium control (headless) # # ============================================================================ set -e # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color echo -e "${GREEN}" echo "============================================================================" echo " OrbStack Development Sandbox Setup" echo "============================================================================" echo -e "${NC}" # Prompt for name and email read -p "Enter your name for git config: " GIT_NAME read -p "Enter your email for git config: " GIT_EMAIL if [ -z "$GIT_NAME" ] || [ -z "$GIT_EMAIL" ]; then echo -e "${RED}Error: Name and email are required.${NC}" exit 1 fi echo "" echo -e "${YELLOW}Setting up with:${NC}" echo " Name: $GIT_NAME" echo " Email: $GIT_EMAIL" echo "" read -p "Continue? (y/n) " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1 fi echo "" echo -e "${GREEN}=== Updating system ===${NC}" sudo apt update && sudo apt upgrade -y echo "" echo -e "${GREEN}=== Installing base dependencies ===${NC}" sudo apt install -y \ curl \ wget \ git \ build-essential \ autoconf \ libncurses5-dev \ libssl-dev \ libwxgtk3.2-dev \ libgl1-mesa-dev \ libglu1-mesa-dev \ libpng-dev \ libssh-dev \ unixodbc-dev \ xsltproc \ fop \ libxml2-utils \ unzip \ inotify-tools \ jq echo "" echo -e "${GREEN}=== Installing PostgreSQL ===${NC}" sudo apt install -y postgresql postgresql-contrib libpq-dev # Start and enable PostgreSQL sudo systemctl enable postgresql sudo systemctl start postgresql # Create user and dev database sudo -u postgres createuser -s $USER 2>/dev/null || echo "PostgreSQL user already exists" createdb dev 2>/dev/null || echo "Database 'dev' already exists" # Allow password-less local connections sudo sed -i "s/local all all peer/local all all trust/" /etc/postgresql/*/main/pg_hba.conf sudo sed -i "s/host all all 127.0.0.1\/32 scram-sha-256/host all all 127.0.0.1\/32 trust/" /etc/postgresql/*/main/pg_hba.conf # Listen on all interfaces (for connections from macOS host) echo "listen_addresses = '*'" | sudo tee -a /etc/postgresql/*/main/postgresql.conf echo "host all all 0.0.0.0/0 trust" | sudo tee -a /etc/postgresql/*/main/pg_hba.conf sudo systemctl restart postgresql echo "" echo -e "${GREEN}=== Installing mise ===${NC}" curl https://mise.run | sh echo 'eval "$(~/.local/bin/mise activate bash)"' >> ~/.bashrc export PATH="$HOME/.local/bin:$PATH" eval "$(~/.local/bin/mise activate bash)" echo "" echo -e "${GREEN}=== Installing Node.js (latest LTS) via mise ===${NC}" mise use -g node@lts echo "" echo -e "${GREEN}=== Installing Erlang 28.3.1 & Elixir 1.19.5-otp-28 via mise ===${NC}" mise use -g erlang@28.3.1 mise use -g elixir@1.19.5-otp-28 echo "" echo -e "${GREEN}=== Installing Chromium (ARM64 native) ===${NC}" # Note: Google Chrome doesn't have ARM64 Linux builds, so we use Chromium sudo apt install -y chromium-browser # Create symlink so tools expecting 'google-chrome' work sudo ln -sf /usr/bin/chromium-browser /usr/bin/google-chrome echo "" echo -e "${GREEN}=== Installing Claude Code ===${NC}" npm install -g @anthropic-ai/claude-code echo "" echo -e "${GREEN}=== Installing Playwright ===${NC}" npx playwright install --with-deps chromium echo "" echo -e "${GREEN}=== Configuring Git ===${NC}" git config --global user.name "$GIT_NAME" git config --global user.email "$GIT_EMAIL" git config --global init.defaultBranch main git config --global pull.rebase false echo "" echo -e "${GREEN}=== Setting up Claude Code plugins (system-wide) ===${NC}" # Create system-wide Claude Code settings directory mkdir -p ~/.config/claude # Add marketplaces echo "Adding marketplaces..." claude plugin marketplace add anthropics/claude-code claude plugin marketplace add obra/superpowers # Install plugins from Anthropic official marketplace echo "Installing Anthropic plugins..." claude plugin install code-review@claude-code-plugins --scope user claude plugin install code-simplifier@claude-code-plugins --scope user claude plugin install feature-dev@claude-code-plugins --scope user claude plugin install pr-review-toolkit@claude-code-plugins --scope user claude plugin install security-guidance@claude-code-plugins --scope user claude plugin install frontend-design@claude-code-plugins --scope user # Install plugins from superpowers marketplace echo "Installing superpowers plugins..." claude plugin install double-shot-latte@superpowers-marketplace --scope user claude plugin install elements-of-style@superpowers-marketplace --scope user claude plugin install superpowers@superpowers-marketplace --scope user claude plugin install superpowers-chrome@superpowers-marketplace --scope user claude plugin install superpowers-lab@superpowers-marketplace --scope user echo "" echo -e "${GREEN}=== Adding MCP servers ===${NC}" claude mcp add playwright --scope user -- npx @anthropic-ai/mcp-server-playwright claude mcp add superpowers-chrome --scope user -- npx github:obra/superpowers-chrome --headless echo "" echo -e "${GREEN}=== Creating projects directory ===${NC}" mkdir -p ~/projects echo "" echo -e "${GREEN}=== Verifying installations ===${NC}" echo "---" echo "Node: $(node --version)" echo "npm: $(npm --version)" echo "Erlang: $(erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell)" echo "Elixir: $(elixir --version | head -1)" echo "Chromium: $(chromium-browser --version)" echo "Claude: $(claude --version)" echo "PostgreSQL: $(psql --version)" echo "mise: $(mise --version)" echo "---" echo "" echo -e "${GREEN}============================================================================${NC}" echo -e "${GREEN} Setup complete!${NC}" echo -e "${GREEN}============================================================================${NC}" echo "" echo "Restart your shell: source ~/.bashrc" echo "" echo -e "${YELLOW}CONNECT FROM macOS:${NC}" echo " SSH: ssh dev-sandbox@orb" echo " Zed: Open Remote Folder → dev-sandbox@orb:~/projects" echo " Files: /Volumes/OrbStack/dev-sandbox/home/$USER/" echo "" echo -e "${YELLOW}POSTGRESQL:${NC}" echo " From VM: psql dev" echo " From macOS: psql -h dev-sandbox.orb.local -d dev" echo " DBeaver host: dev-sandbox.orb.local:5432" echo "" echo -e "${YELLOW}CLAUDE CODE:${NC}" echo " Run: claude" echo " Plugins: claude plugin list" echo ""