Skip to content

Instantly share code, notes, and snippets.

@Arecsu
Created February 10, 2026 00:47
Show Gist options
  • Select an option

  • Save Arecsu/44af6f34fb8725f3cbadf852b96d7f5e to your computer and use it in GitHub Desktop.

Select an option

Save Arecsu/44af6f34fb8725f3cbadf852b96d7f5e to your computer and use it in GitHub Desktop.
ComfyUI Install — Arch + UV + Nvidia
#!/bin/bash
set -e
# ComfyUI Installation Script for Arch Linux + UV + Nvidia
# This script installs ComfyUI to ~/.comfyui/
echo "======================================"
echo "ComfyUI Installation Script"
echo "Target: Arch Linux + UV + Nvidia GPU"
echo "Installation Path: ~/.comfyui/"
echo "======================================"
echo ""
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if UV is installed
if ! command -v uv &> /dev/null; then
echo -e "${RED}ERROR: UV is not installed!${NC}"
echo "Please install UV first: curl -LsSf https://astral.sh/uv/install.sh | sh"
exit 1
fi
echo -e "${GREEN}✓ UV found${NC}"
# Check if git is installed
if ! command -v git &> /dev/null; then
echo -e "${RED}ERROR: git is not installed!${NC}"
echo "Please install git: sudo pacman -S git"
exit 1
fi
echo -e "${GREEN}✓ Git found${NC}"
# Define installation directory
INSTALL_DIR="$HOME/.comfyui"
# Check if directory already exists
if [ -d "$INSTALL_DIR" ]; then
echo -e "${YELLOW}Warning: $INSTALL_DIR already exists${NC}"
read -p "Do you want to remove it and reinstall? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Removing existing installation..."
rm -rf "$INSTALL_DIR"
else
echo "Installation cancelled."
exit 1
fi
fi
# Create installation directory
echo ""
echo "Creating installation directory..."
mkdir -p "$INSTALL_DIR"
cd "$INSTALL_DIR"
# Clone ComfyUI repository
echo ""
echo "Cloning ComfyUI repository..."
git clone https://github.com/comfyanonymous/ComfyUI.git .
# Create virtual environment with UV
echo ""
echo "Creating virtual environment with UV..."
uv venv
# Activate virtual environment
source .venv/bin/activate
echo -e "${GREEN}✓ Virtual environment created and activated${NC}"
# Install PyTorch with CUDA support for Nvidia
echo ""
echo "Installing PyTorch with CUDA 13.0 support..."
echo "This may take a while..."
uv pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu130
echo -e "${GREEN}✓ PyTorch with CUDA support installed${NC}"
# Install ComfyUI dependencies
echo ""
echo "Installing ComfyUI dependencies..."
uv pip install -r requirements.txt
echo -e "${GREEN}✓ ComfyUI dependencies installed${NC}"
# Optional: Install ComfyUI Manager dependencies
echo ""
read -p "Do you want to install ComfyUI Manager? (Y/n): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Nn]$ ]]; then
if [ -f "manager_requirements.txt" ]; then
echo "Installing ComfyUI Manager dependencies..."
uv pip install -r manager_requirements.txt
echo -e "${GREEN}✓ ComfyUI Manager dependencies installed${NC}"
MANAGER_FLAG="--enable-manager"
else
echo -e "${YELLOW}Warning: manager_requirements.txt not found, skipping${NC}"
MANAGER_FLAG=""
fi
else
MANAGER_FLAG=""
fi
# Create model directories
echo ""
echo "Creating model directories..."
mkdir -p models/checkpoints
mkdir -p models/vae
mkdir -p models/loras
mkdir -p models/embeddings
mkdir -p models/upscale_models
mkdir -p models/controlnet
mkdir -p models/vae_approx
echo -e "${GREEN}✓ Model directories created${NC}"
# Create launch script
echo ""
echo "Creating launch script..."
# If manager was installed, use it by default
if [ -n "$MANAGER_FLAG" ]; then
# Manager enabled by default
cat > "$INSTALL_DIR/run.sh" << 'EOF'
#!/bin/bash
cd "$HOME/.comfyui"
source .venv/bin/activate
python main.py --enable-manager "$@"
EOF
cat > "$INSTALL_DIR/run-without-manager.sh" << 'EOF'
#!/bin/bash
cd "$HOME/.comfyui"
source .venv/bin/activate
python main.py "$@"
EOF
chmod +x "$INSTALL_DIR/run-without-manager.sh"
echo -e "${GREEN}✓ Launch scripts created (Manager enabled by default)${NC}"
else
# No manager
cat > "$INSTALL_DIR/run.sh" << 'EOF'
#!/bin/bash
cd "$HOME/.comfyui"
source .venv/bin/activate
python main.py "$@"
EOF
echo -e "${GREEN}✓ Launch script created${NC}"
fi
chmod +x "$INSTALL_DIR/run.sh"
# Create desktop launcher (optional)
echo ""
read -p "Do you want to create a desktop launcher? (Y/n): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Nn]$ ]]; then
echo "Downloading ComfyUI icon..."
mkdir -p "$HOME/.local/share/icons"
curl -L "https://avatars.githubusercontent.com/u/166579949" -o "$HOME/.local/share/icons/comfyui.png"
if [ -f "$HOME/.local/share/icons/comfyui.png" ]; then
echo -e "${GREEN}✓ Icon downloaded${NC}"
else
echo -e "${YELLOW}Warning: Failed to download icon, using default${NC}"
fi
echo "Creating desktop launcher..."
mkdir -p "$HOME/.local/share/applications"
# Use absolute paths (desktop files don't expand $HOME)
cat > "$HOME/.local/share/applications/comfyui.desktop" << EOF
[Desktop Entry]
Version=1.0
Type=Application
Name=ComfyUI
Comment=Visual AI Engine and Application
Exec=$HOME/.comfyui/run.sh
Icon=$HOME/.local/share/icons/comfyui.png
Terminal=true
Categories=Graphics;Development;
StartupNotify=false
EOF
chmod +x "$HOME/.local/share/applications/comfyui.desktop"
# Update desktop database
if command -v update-desktop-database &> /dev/null; then
update-desktop-database "$HOME/.local/share/applications" 2>/dev/null
echo -e "${GREEN}✓ Desktop database updated${NC}"
fi
# Update icon cache if on GTK-based desktop
if command -v gtk-update-icon-cache &> /dev/null; then
gtk-update-icon-cache -f -t "$HOME/.local/share/icons" 2>/dev/null || true
fi
# Update KDE cache if on KDE
if command -v kbuildsycoca6 &> /dev/null; then
kbuildsycoca6 &>/dev/null &
elif command -v kbuildsycoca5 &> /dev/null; then
kbuildsycoca5 &>/dev/null &
fi
echo -e "${GREEN}✓ Desktop launcher created${NC}"
echo -e "${YELLOW}Note: You may need to log out and back in for the launcher to appear${NC}"
fi
# Print completion message
echo ""
echo "======================================"
echo -e "${GREEN}Installation Complete!${NC}"
echo "======================================"
echo ""
echo "Installation directory: $INSTALL_DIR"
echo ""
echo "To run ComfyUI:"
echo " cd ~/.comfyui && ./run.sh"
echo ""
if [ -n "$MANAGER_FLAG" ]; then
echo -e "${GREEN}ComfyUI Manager is ENABLED by default${NC}"
echo "To run without manager: cd ~/.comfyui && ./run-without-manager.sh"
echo ""
fi
echo "Model directories:"
echo " Checkpoints: ~/.comfyui/models/checkpoints"
echo " VAE: ~/.comfyui/models/vae"
echo " LoRAs: ~/.comfyui/models/loras"
echo " Embeddings: ~/.comfyui/models/embeddings"
echo ""
echo "For high-quality previews, download TAESD decoders:"
echo " wget -P ~/.comfyui/models/vae_approx https://github.com/madebyollin/taesd/raw/main/taesd_decoder.pth"
echo " wget -P ~/.comfyui/models/vae_approx https://github.com/madebyollin/taesd/raw/main/taesdxl_decoder.pth"
echo " wget -P ~/.comfyui/models/vae_approx https://github.com/madebyollin/taesd/raw/main/taesd3_decoder.pth"
echo " wget -P ~/.comfyui/models/vae_approx https://github.com/madebyollin/taesd/raw/main/taef1_decoder.pth"
echo ""
echo "Then run with: ./run.sh --preview-method taesd"
echo ""
echo -e "${YELLOW}Don't forget to place your model files in the appropriate directories!${NC}"
echo "======================================"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment