A bash script for ComfyUI Easy Install users that provides flexible path management and launches ComfyUI with SageAttention optimization.
- Git Bash on Windows (or any bash shell on Linux/macOS)
- ComfyUI Easy Install setup
- Optional: gum for enhanced visual output
This script implements a hierarchical path resolution system for ComfyUI's three main directories, allowing you to customize where ComfyUI reads inputs, stores outputs, and manages user data. It's specifically designed for ComfyUI Easy Install users who want more control over their directory structure.
The script manages three key directories with intelligent fallback behavior:
- Environment Variable:
COMFY_OUTPUT_DIR - Fallback:
${COMFY_DIR}/output - Purpose: Generated images and workflow outputs
- Environment Variable:
COMFY_USER_DIR - Fallback:
${COMFY_DIR}/user - Purpose: User-specific settings, custom workflows, and preferences
- Environment Variable:
COMFY_INPUT_DIR - Fallback:
${COMFY_DIR}/input - Purpose: Source location for input images, videos, and other assets
Resolution Priority: Explicit environment variable → COMFY_DIR-based default → unset (uses ComfyUI defaults)
./start_sage# Set environment variables before running
export COMFY_OUTPUT_DIR="/path/to/my/outputs"
export COMFY_USER_DIR="/path/to/my/user/settings"
export COMFY_INPUT_DIR="/path/to/my/inputs"
./start_sage# Pass any ComfyUI command line arguments
./start_sage --port 8080 --cpu --preview-method autoCOMFY_OUTPUT_DIR="/my/outputs" COMFY_USER_DIR="/my/user" ./start_sage --port 8080| Variable | Purpose | Default |
|---|---|---|
COMFY_DIR |
Base ComfyUI directory | ./ComfyUI |
COMFY_OUTPUT_DIR |
Output directory | ${COMFY_DIR}/output |
COMFY_USER_DIR |
User directory | ${COMFY_DIR}/user |
COMFY_INPUT_DIR |
Input directory | ${COMFY_DIR}/input |
- SageAttention Optimization: Automatically enables
--use-sage-attentionfor improved performance - Network Access: Enables
--listenfor web interface access - Manager Legacy Support: Includes
--enable-manager-legacyflag - Path Validation: Shows resolved paths before launching
- Argument Forwarding: Passes through any additional command line arguments
- Visual Output: Uses gum for enhanced formatting when available
- Graceful Fallback: Works with plain echo output when gum is not installed
- Install Git Bash if you haven't already (comes with Git for Windows)
- Place the script in your ComfyUI Easy Install root directory (same level as
ComfyUI/folder) - Make it executable (optional, but recommended):
chmod +x start_sage
- Run from Git Bash:
./start_sage
# For project A
COMFY_OUTPUT_DIR="/projects/project-a/outputs" ./start_sage
# For project B
COMFY_OUTPUT_DIR="/projects/project-b/outputs" ./start_sage# Use a centralized input directory
COMFY_INPUT_DIR="/shared/assets" ./start_sage# Development environment
COMFY_USER_DIR="/dev/comfy-settings" ./start_sage --port 8080
# Production environment
COMFY_USER_DIR="/prod/comfy-settings" ./start_sage --port 80When running, the script displays:
# Starting Comfy with SageAttention
## Configuration Paths
----------------------------------------
Output Directory: ./ComfyUI/output
User Directory: ./ComfyUI/user
Input Directory: ./ComfyUI/input
----------------------------------------
## Command Line Arguments
----------------------------------------
./python_embeded/python.exe
-I
-W
ignore::FutureWarning
ComfyUI/main.py
--use-sage-attention
--listen
--enable-manager-legacy
--output-directory
./ComfyUI/output
--user-directory
./ComfyUI/user
--input-directory
./ComfyUI/input
----------------------------------------
This is normal - the script will use plain text output. Install gum for better formatting:
# Windows (with Chocolatey)
choco install gum
# Or download from: https://github.com/charmbracelet/gum/releasesMake the script executable:
chmod +x start_sageEnsure you're running from the ComfyUI Easy Install root directory where python_embeded/ exists.
- Windows: Requires Git Bash
- Linux/macOS: Works with any bash shell
- ComfyUI: Designed for Easy Install setups, should work with manual installations if directory structure matches
This script is provided as-is for ComfyUI Easy Install users. Modify as needed for your setup.