How to set the COMFYUI_DIR environment variable


Take note of the path to the ComfyUI folder, which contains the models and outputs folders.

Guide for Windows

  1. Open the Environment Variables Settings:

    • Press Win + R to open the Run dialog.
    • Type SystemPropertiesAdvanced and press Enter.
    • Click the Environment Variables button in the Advanced tab.
  2. Add the Environment Variable:

    • In the System Variables section (or User Variables if you prefer setting it for the current user), click New.
    • For Variable Name, enter COMFYUI_DIR.
    • For Variable Value, enter the full path to your ComfyUI folder (e.g., C:\path\to\ComfyUI).
  3. Save and Apply:

    • Click OK to save.
    • Close all dialogs by clicking OK.
  4. Verify:

    • Open Command Prompt (Win + R, type cmd, and press Enter).
    • Run echo %COMFYUI_DIR%.
    • It should display the path to your ComfyUI folder.

Guide for macOS

  1. Open Terminal:

    • Use Spotlight (Cmd + Space) and search for Terminal.
  2. Edit the Shell Configuration File:

    • Determine your default shell:

      echo $SHELL 
      • If it returns /bin/bash, edit ~/.bash_profile.
      • If it returns /bin/zsh, edit ~/.zshrc.
    • Open the appropriate file with a text editor (e.g., nano):

      nano ~/.zshrc 

      or

      nano ~/.bash_profile 
  3. Set the Environment Variable:

    • Add the following line to the file:
      export COMFYUI_DIR="/path/to/ComfyUI" 
      Replace /path/to/ComfyUI with the actual path to your ComfyUI folder.
  4. Apply Changes:

    • Save the file (Ctrl + O, then Enter, then Ctrl + X to exit nano).
    • Run the following command to apply the changes:
      source ~/.zshrc 
      or
      source ~/.bash_profile 
  5. Verify:

    • Run:
      echo $COMFYUI_DIR 
      It should display the path to your ComfyUI folder.

Guide for Linux

  1. Open Terminal:

    • Use your system’s application launcher to open Terminal.
  2. Edit the Shell Configuration File:

    • Determine your default shell:

      echo $SHELL 
      • If it returns /bin/bash, edit ~/.bashrc.
      • If it returns /bin/zsh, edit ~/.zshrc.
    • Open the appropriate file with a text editor (e.g., nano):

      nano ~/.bashrc 

      or

      nano ~/.zshrc 
  3. Set the Environment Variable:

    • Add the following line to the file:
      export COMFYUI_DIR="/path/to/ComfyUI" 
      Replace /path/to/ComfyUI with the actual path to your ComfyUI folder.
  4. Apply Changes:

    • Save the file (Ctrl + O, then Enter, then Ctrl + X to exit nano).
    • Run the following command to apply the changes:
      source ~/.bashrc 
      or
      source ~/.zshrc 
  5. Verify:

    • Run:
      echo $COMFYUI_DIR 
      It should display the path to your ComfyUI folder.

By following the above steps, you can set COMFYUI_DIR on Windows, macOS, or Linux. If you encounter issues, ensure the file paths are correct and that the changes were applied properly.

Get Neu

Buy Now$19.99 USD or more

Leave a comment

Log in with itch.io to leave a comment.