Complete Comfy CLI User Guide
Comfy CLI is the official command-line tool provided by ComfyUI. It not only simplifies the ComfyUI installation process but also offers powerful management capabilities. This guide will comprehensively cover all features of Comfy CLI.
Basic Commands
Installation and Setup
# Install comfy-cli
pip install comfy-cli
# Enable command-line auto-completion
comfy --install-completion
# Install ComfyUI
comfy install
# Launch ComfyUI
comfy launch
Workspace Management
comfy-cli supports managing multiple ComfyUI workspaces, allowing you to maintain different ComfyUI environments simultaneously:
Basic Workspace Operations
# Check current workspace path
comfy which
# Set default workspace
comfy set-default /path/to/your/workspace
# Set default workspace with launch parameters
comfy set-default /path/to/your/workspace --launch-extras="--listen 0.0.0.0 --port 8080"
Executing Commands in Different Workspaces
1. Specify workspace:
# Launch ComfyUI in specified workspace
comfy --workspace=/path/to/workspace launch
# Install nodes in specified workspace
comfy --workspace=/path/to/workspace node install ComfyUI-Impact-Pack
2. Use recent workspace:
# Launch most recently used ComfyUI
comfy --recent launch
# Update nodes in recent workspace
comfy --recent node update all
3. Operate in current directory:
# Install nodes in current directory's ComfyUI
comfy --here node install ComfyUI-Impact-Pack
# Launch ComfyUI in current directory
comfy --here launch
# Check if current directory has ComfyUI
comfy --here which
Workspace Option Restrictions
Important Note:
--workspace
,--recent
, and--here
options cannot be used simultaneously.
Workspace Priority Rules
When you don’t explicitly specify a workspace, comfy-cli will automatically select based on the following priority:
- Default ComfyUI path specified via
comfy set-default <path>
- Most recently executed or installed ComfyUI
- ComfyUI in the current directory
Practical Usage Examples
Scenario 1: Creating Independent Environments for Different Projects
# Create workspace for Project A
comfy --workspace=~/projects/projectA install
# Create workspace for Project B
comfy --workspace=~/projects/projectB install
# Install specific nodes in Project A
comfy --workspace=~/projects/projectA node install ComfyUI-AnimateDiff-Evolved
# Install different nodes in Project B
comfy --workspace=~/projects/projectB node install ComfyUI-Impact-Pack
Scenario 2: Quick Environment Switching
# Set frequently used workspace as default
comfy set-default ~/projects/main-workspace
# Temporarily work in another workspace
comfy --workspace=~/projects/test-workspace launch
# Return to default workspace
comfy launch
Launch Options
ComfyUI provides rich launch options to meet different requirements:
Basic Launch
# Default launch
comfy launch
# Run in background
comfy launch --background
# Stop background instance
comfy stop
Network Configuration
# Specify listen address and port
comfy launch -- --listen 0.0.0.0 --port 8080
# Allow external access
comfy launch -- --listen 0.0.0.0
Performance Optimization
# Use CPU mode
comfy launch -- --cpu
# Low VRAM mode
comfy launch -- --lowvram
# Ultra-low VRAM mode
comfy launch -- --novram
# Enable model CPU offloading
comfy launch -- --cpu-vae
Custom Node Management
Node Information Viewing
# Show all available node information
comfy node show all
# Simple display of installed nodes
comfy node simple-show installed
# Show enabled nodes
comfy node show enabled
# Show uninstalled nodes
comfy node show not-installed
# Show disabled nodes
comfy node show disabled
# Show nodes from specific channel
comfy node show all --channel recent
Node Installation and Updates
# Install custom nodes
comfy node install ComfyUI-Impact-Pack
# Update all nodes
comfy node update all
# Update specific node
comfy node update ComfyUI-Impact-Pack
Node Snapshot Management
Snapshot functionality helps you save and restore node configuration states:
# Save node snapshot
comfy node save-snapshot
# View snapshot list
comfy node show snapshot-list
# Restore node snapshot
comfy node restore-snapshot <snapshot_name>
Dependency Management
# Install dependencies from workflow file
comfy node install-deps --workflow=workflow.json
# Install dependencies from workflow PNG file
comfy node install-deps --workflow=workflow.png
# Install from dependency JSON file
comfy node install-deps --deps=dependencies.json
# Generate workflow dependency file
comfy node deps-in-workflow --workflow=workflow.json --output=deps.json
Node Troubleshooting (Bisect)
When encountering node conflicts or issues, use the bisect feature to quickly identify problematic nodes:
# Start troubleshooting session
comfy node bisect start
# Mark current state as good
comfy node bisect good
# Mark current state as problematic
comfy node bisect bad
# Reset troubleshooting session
comfy node bisect reset
Model Management
Model Downloads
# Download models from URL (supports CivitAI, Hugging Face, etc.)
comfy model download --url https://huggingface.co/model/url
# Download to specified relative path
comfy model download --url https://civitai.com/api/download/models/123456 --relative-path models/checkpoints
# Set CivitAI API Token (for downloading login-required models)
comfy model download --url https://civitai.com/api/download/models/123456 --set-civitai-api-token YOUR_TOKEN
# Combine multiple options
comfy model download --url https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned.safetensors --relative-path models/checkpoints
Model Management
# List all models in default path
comfy model list
# List models in specified path
comfy model list --relative-path models/loras
# Remove specified models
comfy model remove --model-names "model1.safetensors,model2.ckpt"
# Remove models from specified path
comfy model remove --relative-path models/checkpoints --model-names "old_model.ckpt"
Supported Model Sources
- Hugging Face: Use direct file URLs
- CivitAI: Use model download API URLs
- Other direct links: Any directly downloadable model file URLs
ComfyUI-Manager Management
comfy-cli can also manage ComfyUI-Manager settings:
# Disable ComfyUI-Manager GUI (menu and server)
comfy manager disable-gui
# Enable ComfyUI-Manager GUI
comfy manager enable-gui
# Clear reserved startup actions
comfy manager clear
Environment Information
View detailed information about the current ComfyUI environment:
# Show environment information including running status, workspace, etc.
comfy env
# Check tracking settings status
comfy tracking status
# Disable usage tracking
comfy tracking disable
# Enable usage tracking
comfy tracking enable
Advanced Features
Beta Feature: comfy-lock.yaml
comfy-cli supports using comfy-lock.yaml
files to manage project dependencies:
basic:
models:
- model: [Model Name]
url: [Model source URL, e.g., https://huggingface.co/...]
paths: [Model path list]
- path: [Model path]
- path: [Model path]
hashes: [Model hashes]
- hash: [Hash value]
type: [AutoV1, AutoV2, SHA256, CRC32, Blake3]
type: [Model type, e.g., diffuser, lora, etc.]
# Compatible with ComfyUI-Manager .yaml snapshots
custom_nodes:
comfyui: [commit hash]
file_custom_nodes:
- disabled: [bool]
filename: [.py filename]
...
git_custom_nodes:
[git-url]:
disabled: [bool]
hash: [commit hash]
...
Common Usage Scenarios
Development Environment Management
# Create development environment
comfy --workspace=~/dev/comfyui-dev install
# Create test environment
comfy --workspace=~/test/comfyui-test install
# Install experimental nodes in development environment
comfy --workspace=~/dev/comfyui-dev node install experimental-node
# Quickly switch to test environment for testing
comfy --workspace=~/test/comfyui-test launch
Project Dependency Management
# Create dependency snapshot for project
comfy node save-snapshot project-v1.0
# Install project workflow dependencies
comfy node install-deps --workflow=project-workflow.json
# Restore to specific version dependencies
comfy node restore-snapshot project-v1.0
Automated Model Management
# Batch download required models for project
comfy model download --url https://huggingface.co/model1 --relative-path models/checkpoints
comfy model download --url https://huggingface.co/model2 --relative-path models/loras
# Clean up old models
comfy model remove --model-names "old_model1.ckpt,old_model2.safetensors"
Troubleshooting
Common Issues
-
Workspace Path Issues
# Check current workspace comfy which # If path is incorrect, reset it comfy set-default /correct/path
-
Node Conflict Issues
# Use bisect feature to locate problems comfy node bisect start # Mark normal/abnormal status as prompted
-
Permission Issues
# Ensure sufficient permissions ls -la ~/comfy
Related Links
- Comfy CLI GitHub Repository
- Comfy CLI Official Documentation
- ComfyUI Linux Installation Guide
- ComfyUI Official Repository