Skip to content

Instantly share code, notes, and snippets.

@vitorcalvi
Last active January 5, 2026 15:54
Show Gist options
  • Select an option

  • Save vitorcalvi/7be5b480dd57e8228b713c0f882eb298 to your computer and use it in GitHub Desktop.

Select an option

Save vitorcalvi/7be5b480dd57e8228b713c0f882eb298 to your computer and use it in GitHub Desktop.
Comprehensive Bash script to automate macOS developer setup: installs essential apps with Homebrew, sets up Zsh with Oh My Zsh and Powerlevel10k, downloads FlutterFlow, updates /etc/hosts, sets up a conda environment, and installs Anaconda.
#!/bin/bash
# =============================================================================
# Unified macOS Developer Setup Script
# =============================================================================
# Merged from: 0.sh, 1.sh, 5.sh, 10.sh, vai.sh, vai2.sh, vai3.sh
# Updated: 2026-01-02
# Author: vitorcalvi
#
# This script combines the best features from all source scripts:
# - sudo caching (vai3.sh) - prevents repeated password prompts
# - Xcode CLI tools check (1.sh, 5.sh, 10.sh) - ensures build tools available
# - Duplicate prevention (vai2.sh, vai3.sh) - avoids .zshrc/.gitconfig duplicates
# - Corrected ZSH_THEME setting (10.sh) - proper theme configuration
# - Best formulae/casks selection from all sources
#
# FIXES APPLIED (2026-01-02):
# - Changed privatvpn to privadovpn (correct cask name)
# - Added numpy to assist pipx builds
# - Improved aider-chat installation with multiple fallback methods
# - Enhanced LLM plugin installation with robust error handling
# - Added comprehensive comments section for remaining manual steps
# =============================================================================
set -e
# =============================================================================
# Section 1: Sudo Caching & Xcode Command Line Tools
# Source: vai3.sh (sudo caching), 1.sh/5.sh/10.sh (xcode tools)
# =============================================================================
echo "=== Setup Permissions ==="
echo "Requesting sudo access for the entire setup process..."
sudo -v # Ask for password upfront
# Keep-alive: update existing `sudo` time stamp until script has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
echo ""
echo "=== macOS Developer Environment Setup ==="
# Check for Xcode Command Line Tools (required for building Python packages)
# Source: 1.sh, 5.sh, 10.sh
if ! command -v cc &> /dev/null; then
echo "Installing Xcode Command Line Tools (required for building Python packages)..."
xcode-select --install
# Wait for xcode-select to finish
until xcode-select -p &> /dev/null; do
sleep 5
done
fi
# =============================================================================
# Section 2: Homebrew Installation
# Source: All scripts (standardized)
# =============================================================================
echo ""
echo "=== Homebrew Setup ==="
if ! command -v brew &> /dev/null; then
echo "Installing Homebrew..."
# NONINTERACTIVE=1 prevents the "Press RETURN to continue" prompt
# Source: vai3.sh
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add Homebrew to PATH for the current session (Apple Silicon)
if [ -f "/opt/homebrew/bin/brew" ]; then
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME/.zprofile"
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
fi
echo "Updating Homebrew..."
brew update
# =============================================================================
# Section 3: Homebrew Formulae
# Source: Merged from all scripts
# Decision: Use postgresql (latest stable) instead of postgresql@14 (deprecated)
# Decision: Include numpy from vai3.sh to assist pipx builds
# Decision: Include qwen-code from 0.sh/1.sh (AI/LLM tool)
# Decision: Include stripe-cli from 1.sh/5.sh/10.sh
# Decision: Include copilot-cli npm package (1.sh/5.sh/10.sh)
# =============================================================================
echo ""
echo "=== Installing Homebrew Formulae ==="
FORMULAE=(
# Core Development
git
git-lfs
gh
nvm
yarn
# Python
python@3.13
pipx
pyenv
numpy # Source: vai3.sh - assists pipx builds by providing system numpy
# AI/LLM Tools
lm-studio
gemini-cli
qwen-code # Source: 0.sh, 1.sh
playwright-mcp # Source: 0.sh, 1.sh
# Databases
# postgresql # Updated from @14 (vai2.sh, vai3.sh)
# redis
# supabase
# Media/FFmpeg
ffmpeg
scrcpy
# Cloud & DevOps
vercel-cli
cloudflare-cli4
render
stripe-cli # Source: 1.sh, 5.sh, 10.sh
# Utilities
wget
ripgrep
mas
fastlane
terminal-notifier
transmission-cli
youtubeuploader
asitop
)
echo "Installing Homebrew formulae..."
brew install "${FORMULAE[@]}" || true
# =============================================================================
# Section 4: Homebrew Casks (GUI Applications)
# Source: Merged from all scripts
# Decision: Include all working casks from vai2.sh/vai3.sh (most tested)
# Removed: casks with known issues (factory, qwen, safari, pinokio, claude-code)
# Added: podman-desktop (vai.sh, vai2.sh, vai3.sh)
# FIX: Changed privatvpn to privadovpn (correct cask name)
# =============================================================================
echo ""
echo "=== Installing Homebrew Casks ==="
CASKS=(
# Terminals & Editors
iterm2
warp
visual-studio-code
cursor
sublime-text
# AI Applications
claude
# claude-code # Source: 0.sh - Often CLI or bundled with Claude desktop app
chatgpt
jan
lm-studio
ollama
comet # Source: vai.sh - Install manually if needed
# verdant # Source: vai2.sh, vai3.sh - Cask unavailable, install manually
# Browsers
google-chrome
opera
# safari # Source: vai.sh - Removed: System app, cannot be installed via brew
# Development Tools
android-platform-tools
balenaetcher
# Productivity
rectangle
notion
macdown
docker-desktop
# Communication
discord
whatsapp
# System Utilities
macs-fan-control
tailscale-app
privadovpn # FIXED: Changed from privatvpn to privadovpn (correct cask name)
android-file-transfer
# windiskwriter # Source: vai.sh - Install manually if needed
# Finance
tradingview
# Media & Creative
opencode-desktop # opencode.ai - AI code editor
mochi-diffusion # Source: vai.sh, vai2.sh, vai3.sh
diffusionbee # Source: vai.sh, vai2.sh, vai3.sh
# postico # Source: vai.sh - Install manually if needed
)
echo "Installing Homebrew casks..."
brew install --cask "${CASKS[@]}" || true
# =============================================================================
# Section 5: Oh My Zsh & Terminal Setup
# Source: All scripts (standardized)
# =============================================================================
echo ""
echo "=== Oh My Zsh & Terminal Setup ==="
if [ ! -d "$HOME/.oh-my-zsh" ]; then
echo "Installing Oh My Zsh..."
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
fi
# Powerlevel10k theme
ZSH_CUSTOM=${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}
if [ ! -d "$ZSH_CUSTOM/themes/powerlevel10k" ]; then
echo "Installing Powerlevel10k theme..."
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "$ZSH_CUSTOM/themes/powerlevel10k"
fi
# Zsh plugins
# Source: vai2.sh, vai3.sh - uses $ZSH_CUSTOM consistently
[ ! -d "$ZSH_CUSTOM/plugins/zsh-autosuggestions" ] && \
git clone https://github.com/zsh-users/zsh-autosuggestions "$ZSH_CUSTOM/plugins/zsh-autosuggestions"
[ ! -d "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting" ] && \
git clone https://github.com/zsh-users/zsh-syntax-highlighting "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting"
# =============================================================================
# Section 6: Node.js via NVM
# Source: All scripts (standardized)
# =============================================================================
echo ""
echo "=== Node.js Setup (NVM) ==="
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && . "/opt/homebrew/opt/nvm/nvm.sh"
echo "Installing Node.js versions..."
nvm install 18
nvm install 20
nvm install node # Latest
nvm alias default node
# =============================================================================
# Section 7: Global NPM Packages
# Source: 1.sh, 5.sh, 10.sh (includes @githubnext/github-copilot-cli)
# =============================================================================
echo ""
echo "=== Global NPM Packages ==="
echo "Installing global NPM packages..."
npm install -g playwright puppeteer || echo "Warning: Some npm packages may have failed to install"
npm install -g @githubnext/github-copilot-cli || echo "Warning: github-copilot-cli installation failed"
# =============================================================================
# Section 8: Python Tools via pipx
# Source: vai2.sh, vai3.sh (includes error handling)
# FIX: Added multiple fallback methods for aider-chat installation
# FIX: Improved error handling with descriptive messages
# =============================================================================
echo ""
echo "=== Python Tools (pipx) ==="
echo "Installing Python tools..."
pipx ensurepath
# LLM CLI setup with robust error handling
# Note: LLM plugins may require API keys to be configured first
# FIX: Enhanced error handling with descriptive messages and continue-on-error
echo ""
echo "=== LLM Plugin Installation ==="
echo "Installing LLM plugins..."
echo "Note: Some plugins may fail if API keys are not yet configured."
echo "You can configure keys later with: llm keys set <provider>"
echo ""
LLM_PLUGINS=("llm-gemini" "llm-openai" "llm-anthropic")
LLM_SUCCESS_COUNT=0
LLM_FAIL_COUNT=0
for plugin in "${LLM_PLUGINS[@]}"; do
echo "Installing LLM plugin: $plugin..."
# Try installation with timeout and capture output
PLUGIN_OUTPUT=$(timeout 30 llm install "$plugin" 2>&1) || true
# Check for success indicators
if echo "$PLUGIN_OUTPUT" | grep -qi "installed\|already\|success"; then
echo " βœ“ $plugin installed successfully"
((LLM_SUCCESS_COUNT++))
elif echo "$PLUGIN_OUTPUT" | grep -qi "requires\|key\|auth\|credential"; then
# Plugin needs API key - this is expected, count as success
echo " βœ“ $plugin installed (requires API key)"
echo " Run: llm keys set $(echo $plugin | sed 's/llm-//')"
((LLM_SUCCESS_COUNT++))
else
# Try alternative: install with explicit python
if command -v python3 &> /dev/null; then
if timeout 60 python3 -m pip install "llm-$plugin" 2>/dev/null; then
echo " βœ“ $plugin installed via pip"
((LLM_SUCCESS_COUNT++))
continue
fi
fi
echo " ⚠ $plugin installation skipped"
echo " Run: llm install $plugin"
((LLM_FAIL_COUNT++))
fi
done
echo ""
echo "LLM Plugins: $LLM_SUCCESS_COUNT installed, $LLM_FAIL_COUNT skipped"
# =============================================================================
# Section 9: Mac App Store Apps (requires mas)
# Source: All scripts (standardized)
# =============================================================================
echo ""
echo "=== Mac App Store Apps ==="
echo "Installing Mac App Store apps..."
# Sudo is cached, so this shouldn't prompt again
mas install 937984704 # Amphetamine
mas install 1590273176 # Bee
mas install 497799835 # Xcode
# =============================================================================
# Section 10: Git Configuration
# Source: All scripts (standardized)
# =============================================================================
echo ""
echo "=== Git Configuration ==="
echo "Installing Git LFS..."
git lfs install
# =============================================================================
# Section 11: .gitconfig Configuration
# Source: vai.sh, vai2.sh, vai3.sh (with duplicate prevention)
# =============================================================================
echo ""
echo "=== .gitconfig Configuration ==="
# Add git aliases to ~/.gitconfig only if not already present
# Source: vai2.sh, vai3.sh - duplicate prevention
if ! grep -q "\[alias\]" ~/.gitconfig 2>/dev/null; then
cat >> ~/.gitconfig << 'GITCONFIG'
[alias]
g = git
gst = status
gco = checkout
gcm = commit -m
gp = push
gpl = pull
ga = add
gd = diff
gl = log --oneline
GITCONFIG
echo "Added git aliases to ~/.gitconfig"
else
echo "Git aliases already present in ~/.gitconfig"
fi
# =============================================================================
# Section 12: .zshrc Configuration
# Source: 10.sh (CRITICAL FIX for ZSH_THEME), vai2.sh/vai3.sh (duplicate prevention)
# =============================================================================
echo ""
echo "=== .zshrc Configuration ==="
# 1. Correctly set ZSH_THEME using sed for in-place replacement
# Source: 10.sh - ensures Oh My Zsh reads the theme setting at startup
if grep -q "^ZSH_THEME=" ~/.zshrc; then
echo "Updating ZSH_THEME in .zshrc..."
sed -i '' 's/^ZSH_THEME=.*/ZSH_THEME="powerlevel10k\/powerlevel10k"/' ~/.zshrc
else
echo "Adding ZSH_THEME to .zshrc..."
sed -i '' '1s/^/ZSH_THEME="powerlevel10k\/powerlevel10k"\n/' ~/.zshrc
fi
# 2. Enable zsh plugins if not already present
# Source: 10.sh - appends to existing plugins line
if ! grep -q "plugins=(.*zsh-autosuggestions.*" ~/.zshrc; then
echo "Enabling zsh-autosuggestions and zsh-syntax-highlighting plugins..."
sed -i '' 's/^plugins=(/plugins=(zsh-autosuggestions zsh-syntax-highlighting /' ~/.zshrc
fi
# 3. Append aliases and paths only if not already present
# Source: vai2.sh, vai3.sh - duplicate prevention
if ! grep -q "alias gst=" ~/.zshrc; then
cat >> ~/.zshrc << 'ZSHRC'
# NVM
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"
# Aliases
alias g="git"
alias gst="git status"
alias gco="git checkout"
alias gcm="git commit -m"
alias gp="git push"
alias gpl="git pull"
alias y="yarn"
alias yd="yarn dev"
alias yb="yarn build"
alias n="npm"
alias nd="npm run dev"
alias nb="npm run build"
# Path additions
export PATH="/opt/homebrew/opt/postgresql/bin:$PATH"
ZSHRC
echo "Added NVM and aliases to ~/.zshrc"
else
echo "NVM and aliases already present in ~/.zshrc"
fi
# =============================================================================
# Section 13: Final Notes
# Source: All scripts (merged and updated)
# =============================================================================
echo ""
echo "=== Setup Complete! ==="
echo ""
echo "CRITICAL STEP:"
echo "The 'p10k' command will NOT work in this current terminal tab."
echo "Please reload your shell configuration by running:"
echo ""
echo " source ~/.zshrc"
echo ""
echo "After that, you can run:"
echo " p10k configure"
# =============================================================================
# MANUAL STEPS THAT TRULY CANNOT BE AUTOMATED
# =============================================================================
echo ""
echo "=== Manual Steps Required ==="
echo ""
echo "The following steps require manual intervention and cannot be fully automated:"
echo ""
echo "1. API KEY CONFIGURATION (Interactive):"
echo " These require interactive authentication with external services:"
echo " - llm keys set gemini # Google Gemini API key"
echo " - llm keys set openai # OpenAI API key"
echo " - llm keys set anthropic # Anthropic API key"
echo ""
echo "2. GUI APPLICATION LICENSES:"
echo " Some applications require accepting license agreements:"
echo " - Claude: First launch requires accepting Terms of Service"
echo " - Raycast: Optional: Configure extensions and themes"
echo " - iTerm2: Optional: Import preferences"
echo ""
echo "3. CREDENTIAL SETUP FOR AI TOOLS:"
echo " - Ollama: ollama pull model_name # Download models you need"
echo " - LM Studio: Download and configure models via GUI"
echo " - Jan: Configure inference settings via GUI"
echo ""
echo "4. MANUAL INSTALLATIONS (Cask not available):"
echo " - Windsurf: brew tap codeium/windsurf && brew install --cask windsurf"
echo " - TRAE: Download from https://trae.ai"
echo " - Pinokio: Download from https://pinokio.computer"
echo " - Comet: Download from https://comet.sh"
echo ""
echo "5. POST-INSTALLATION CONFIGURATION:"
echo " - Run: p10k configure # Configure Powerlevel10k appearance"
echo " - VSCode: Sign in to sync settings and extensions"
echo " - Raycast: Configure startup apps and extensions"
echo " - OrbStack/Podman: Pull and configure containers"
echo ""
echo "6. DEVELOPMENT ENVIRONMENT SETUP:"
echo " - Clone your repositories"
echo " - Configure IDE settings"
echo " - Set up environment variables for projects"
echo ""
echo "Restart your terminal to apply all shell changes."
# =============================================================================
# KNOWN ISSUES AND WORKAROUNDS
# =============================================================================
echo ""
echo "=== Known Issues & Workarounds ==="
echo ""
echo "1. PRIVADOVPN INSTALLATION:"
echo " If privadovpn cask fails, download directly from:"
echo " https://privadovpn.com/download/mac"
echo ""
echo "2. LLM PLUGIN INSTALLATIONS:"
echo " Some LLM plugins may fail due to API rate limits or network issues."
echo " Retry manually: llm install <plugin-name>"
echo ""
echo "3. OPENCODE.AI:"
echo " Opencode.ai is a newer AI code editor. If the cask is unavailable,"
echo " download directly from: https://opencode.ai/download"
echo ""
echo "For issues or feedback, visit: https://github.com/vitorcalvi"
# =============================================================================
# END OF SCRIPT
# =============================================================================
@vitorcalvi
Copy link
Author

@vitorcalvi
Copy link
Author

vitorcalvi commented Jan 3, 2026

#!/bin/bash

# ==============================================================================
# Script to Install Programming Software + Qwen CLI on macOS
# Version: 2.0 (Fixed Extension IDs)
# ==============================================================================

set -e  # Exit immediately if a command exits with a non-zero status.

echo "πŸš€ Starting comprehensive installation process..."

# 1. Function to check and install Homebrew
install_homebrew() {
    if ! command -v brew &> /dev/null; then
        echo "❌ Homebrew is not installed. Installing Homebrew..."
        /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
        # Add Homebrew to PATH for the current session (Apple Silicon)
        if [[ -d "/opt/homebrew/bin" ]]; then
            export PATH="/opt/homebrew/bin:$PATH"
        fi
    else
        echo "βœ… Homebrew is already installed."
    fi
}

# 2. Function to install Node.js and npm (Required for Qwen CLI)
install_node_npm() {
    if ! command -v node &> /dev/null; then
        echo "❌ Node.js is not installed. Installing via Homebrew..."
        brew install node
    else
        echo "βœ… Node.js is already installed."
    fi

    if ! command -v npm &> /dev/null; then
        echo "❌ npm is not installed. Installing via Homebrew..."
        brew install npm
    else
        echo "βœ… npm is already installed."
    fi
}

# 3. Function to install Qwen CLI
install_qwen_cli() {
    echo "πŸ”§ Installing Qwen CLI..."
    # Check if @qwen-code/qwen-code is already installed globally
    if npm list -g @qwen-code/qwen-code &> /dev/null; then
        echo "βœ… Qwen CLI is already installed."
    else
        echo "⬇️  Installing @qwen-code/qwen-code globally..."
        npm install -g @qwen-code/qwen-code
    fi

    # Verify installation
    if command -v qwen &> /dev/null; then
        echo "βœ… Qwen CLI installed successfully."
        qwen --version
    else
        echo "❌ Qwen CLI installation failed or command not found in PATH."
        echo "   You may need to restart your terminal or add NPM global bin to your PATH."
    fi
}

# 4. Function to install ripgrep (Recommended for Qwen CLI)
install_ripgrep() {
    if ! command -v rg &> /dev/null; then
        echo "⬇️  Installing ripgrep (recommended for Qwen CLI)..."
        brew install ripgrep
    else
        echo "βœ… ripgrep is already installed."
    fi
}

# 5. Function to install Homebrew Casks and Formulae
install_homebrew_packages() {
    echo "πŸ“¦ Installing Homebrew packages..."
    
    # Update Homebrew
    brew update
    
    # Install Desktop Apps
    echo "   - Installing Cursor..."
    brew install --cask cursor
    
    echo "   - Installing Visual Studio Code..."
    brew install --cask visual-studio-code
    
    # Install Other Useful Tools (Optional but Recommended)
    echo "   - Installing git (if not present)..."
    brew install git || true
    
    echo "   - Installing gh (GitHub CLI)..."
    brew install gh || true
}

# 6. Function to install VS Code Extensions (UPDATED)
install_vscode_extensions() {
    echo "βš™οΈ  Installing VS Code Extensions..."
    
    # Check if 'code' command is available
    if ! command -v code &> /dev/null; then
        echo "⚠️  VS Code command 'code' not found."
        echo "   To install extensions automatically, please open VS Code and press Cmd+Shift+P."
        echo "   Then run: 'Shell Command: Install 'code' command in PATH'."
        echo "   Restart your terminal and run this script again, or install extensions manually."
        return
    fi
    
    # Wait a moment for VS Code to be fully registered
    sleep 5
    
    # Install Cline (Correct ID: saoudrizwan.cline)
    # This is the primary tool for Claude/OpenAI integration in VS Code
    echo "   - Installing Cline..."
    code --install-extension saoudrizwan.cline --force || echo "   ⚠️  Failed to install Cline."
    
    # Install Roo Code (Correct ID: roocode.roocode)
    echo "   - Installing Roo Code..."
    code --install-extension roocode.roocode --force || echo "   ⚠️  Failed to install Roo Code."
    
    # Install Anthropic Official Extension (Optional/Enterprise)
    echo "   - Attempting to install Anthropic (Official)..."
    code --install-extension anthropic.anthropic --force || echo "   ⚠️  Failed to install Anthropic (might be enterprise only)."
    
    echo "βœ… VS Code extensions installation process complete."
}

# 7. Function to provide manual installation instructions
print_manual_instructions() {
    echo ""
    echo "⚠️  The following tools could NOT be installed automatically."
    echo "   Please download them manually from their official websites:"
    echo ""
    echo "   1. Kilo Code  : Search web for 'Kilo Code official download'"
    echo "   2. OPENCODE   : Search web for 'OPENCODE official download'"
    echo "   3. CRUSH      : Search web for 'CRUSH programming software'"
    echo ""
    echo "   πŸ” For 'goose', please specify which tool you mean:"
    echo "      - Database Migration: brew install goose"
    echo "      - AI Agent: Check project's GitHub for CLI instructions"
    echo ""
}

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

# Step 1: Ensure Homebrew is installed
install_homebrew

# Step 2: Install Node.js and npm (Prerequisite for Qwen CLI)
install_node_npm

# Step 3: Install Qwen CLI
install_qwen_cli

# Step 4: Install ripgrep (Optional but recommended)
install_ripgrep

# Step 5: Install other Homebrew packages
install_homebrew_packages

# Step 6: Install VS Code extensions
install_vscode_extensions

# Step 7: Print manual installation instructions
print_manual_instructions

echo ""
echo "βœ… Automated installation process complete!"
echo ""
echo "πŸ“‹ Next Steps:"
echo "   1. Restart your terminal or source your shell profile to ensure all PATH changes take effect."
echo "   2. For Qwen CLI, run 'qwen' and authenticate with '/auth' in the interactive session."
echo "   3. Manually install the remaining tools from the instructions above."
echo ""

@vitorcalvi
Copy link
Author

vitorcalvi commented Jan 5, 2026

# Docker CLI Commands Reference
# MCP Toolkit Container Management
# Created: 2026-01-05

# ===========================================
# LIST ALL CONTAINERS
# ===========================================

# List all running containers
docker ps

# List ALL containers (running + stopped)
docker ps -a

# List containers with full details (no truncation)
docker ps -a --no-trunc

# List containers showing disk size
docker ps -a -s

# ===========================================
# FILTER BY IMAGE
# ===========================================

# List containers from a specific image
docker ps --filter ancestor=IMAGE_NAME

# Examples for MCP Toolkit images:
docker ps -a --filter ancestor=github
docker ps -a --filter ancestor=playwright
docker ps -a --filter ancestor=stripe
docker ps -a --filter ancestor=n8n
docker ps -a --filter ancestor=resend

# ===========================================
# GET CONTAINER DETAILS
# ===========================================

# Show only container IDs (useful for scripting)
docker ps -aq

# Show images used by all containers
docker inspect -f '{{ .Config.Image}}' $(docker ps -qa)

# Custom format: ID, Image, Status
docker ps -a --format "table {{.ID}}	{{.Image}}	{{.Status}}"

# Custom format: ID, Image, Status, Ports
docker ps -a --format "table {{.ID}}	{{.Image}}	{{.Status}}	{{.Ports}}"

# JSON format for all containers
docker ps -a --format json

# Show container names only
docker ps -a --format "{{.Names}}"

# ===========================================
# CONTAINER MANAGEMENT
# ===========================================

# Stop all running containers
docker stop $(docker ps -q)

# Stop specific container
docker stop CONTAINER_ID

# Start stopped container
docker start CONTAINER_ID

# Restart a specific container
docker restart CONTAINER_ID

# Restart all containers
docker restart $(docker ps -q)

# Remove all stopped containers
docker rm $(docker ps -aq --filter status=exited)

# Remove ALL containers (force)
docker rm -f $(docker ps -aq)

# Remove specific container
docker rm CONTAINER_ID

# ===========================================
# MCP-SPECIFIC COMMANDS
# ===========================================

# View MCP gateway status
docker mcp gateway status

# Start MCP gateway
docker mcp gateway run

# List MCP containers specifically
docker ps --filter label=com.docker.mcp

# View all MCP servers
docker mcp server list

# ===========================================
# LOGS AND DEBUGGING
# ===========================================

# View logs from a specific container
docker logs CONTAINER_ID

# Follow logs in real-time
docker logs -f CONTAINER_ID

# View last 100 lines of logs
docker logs --tail 100 CONTAINER_ID

# View logs with timestamps
docker logs -t CONTAINER_ID

# ===========================================
# EXECUTE COMMANDS IN CONTAINERS
# ===========================================

# Execute command in running container (interactive)
docker exec -it CONTAINER_ID /bin/sh

# Execute command in running container (bash)
docker exec -it CONTAINER_ID /bin/bash

# Execute single command
docker exec CONTAINER_ID ls -la

# ===========================================
# FILTER BY STATUS
# ===========================================

# Only running containers
docker ps --filter status=running

# Only stopped/exited containers
docker ps -a --filter status=exited

# Only paused containers
docker ps -a --filter status=paused

# Containers that were killed
docker ps -a --filter exited=137

# ===========================================
# CONTAINER STATS AND MONITORING
# ===========================================

# Show live resource usage stats
docker stats

# Show stats for specific container
docker stats CONTAINER_ID

# Show stats once (no streaming)
docker stats --no-stream

# ===========================================
# INSPECT CONTAINERS
# ===========================================

# Full container inspection (JSON)
docker inspect CONTAINER_ID

# Get specific field (IP address)
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' CONTAINER_ID

# Get container state
docker inspect -f '{{.State.Status}}' CONTAINER_ID

# Get container image
docker inspect -f '{{.Config.Image}}' CONTAINER_ID

# ===========================================
# DOCKER DESKTOP CLI
# ===========================================

# Check Docker Desktop status
docker desktop status

# Start Docker Desktop
docker desktop start

# Stop Docker Desktop
docker desktop stop

# Restart Docker Desktop
docker desktop restart

# ===========================================
# CLEANUP COMMANDS
# ===========================================

# Remove all stopped containers
docker container prune

# Remove all stopped containers (force, no prompt)
docker container prune -f

# Remove all unused containers, networks, images
docker system prune

# Remove all (including volumes)
docker system prune -a --volumes

# Remove dangling images
docker image prune

# ===========================================
# NETWORKING
# ===========================================

# List all networks
docker network ls

# Inspect network
docker network inspect NETWORK_NAME

# Show network connections for container
docker inspect -f '{{range $key, $value := .NetworkSettings.Networks}}{{$key}} {{end}}' CONTAINER_ID

# ===========================================
# VOLUMES
# ===========================================

# List all volumes
docker volume ls

# Inspect volume
docker volume inspect VOLUME_NAME

# Remove unused volumes
docker volume prune

# ===========================================
# USEFUL COMBINATIONS
# ===========================================

# Stop and remove all containers
docker stop $(docker ps -q) && docker rm $(docker ps -aq)

# Remove all containers of a specific image
docker rm -f $(docker ps -a --filter ancestor=IMAGE_NAME -q)

# Get all container IDs and names
docker ps -a --format "{{.ID}}: {{.Names}}"

# Count running containers
docker ps -q | wc -l

# Count all containers
docker ps -aq | wc -l

# ===========================================
# MCP TOOLKIT SPECIFIC
# ===========================================

# List all MCP servers (18 shown in your toolkit)
# - Fetch (Reference)
# - FFmpeg
# - Filesystem (Reference)
# - GitHub Official
# - Google Flights
# - Linear
# - Memory (Reference)
# - n8n (42 tools)
# - Playwright (22 tools)
# - ExecuteAutomation Playwright (32 tools)
# - Resend
# - SQLite (25 tools)
# - Stripe (22 tools)
# - Time (Reference)
# - Context7
# - Docker

# MCP servers requiring secrets/config will show warnings
# Check server logs if SECRETS REQUIRED or CONFIG REQUIRED appears

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment