How to set the COMFYUI_DIR environment variable
![](https://img.itch.zone/aW1hZ2UvMzIwNjAzNC8xOTI1MTg0MS5wbmc=/x200/E%2Fmd9L.png)
![](https://img.itch.zone/aW1hZ2UvMzIwNjAzNC8xOTI1MjE4MC5wbmc=/x200/fgjnaK.png)
![](https://img.itch.zone/aW1hZ2UvMzIwNjAzNC8xOTI1MjA1OS5wbmc=/x200/ffRdYx.png)
![](https://img.itch.zone/aW1hZ2UvMzIwNjAzNC8xOTI1NTMwMS5wbmc=/x200/e7MwEr.png)
![](https://img.itch.zone/aW1hZ2UvMzIwNjAzNC8xOTI1MTgyNC5wbmc=/x200/JAN0Ln.png)
![](https://img.itch.zone/aW1hZ2UvMzIwNjAzNC8xOTI1MTgyNS5wbmc=/x200/BJGtdk.png)
Take note of the path to the ComfyUI folder, which contains the models
and outputs
folders.
Guide for Windows
-
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.
- Press
-
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
).
-
Save and Apply:
- Click OK to save.
- Close all dialogs by clicking OK.
-
Verify:
- Open Command Prompt (
Win + R
, typecmd
, and press Enter). - Run
echo %COMFYUI_DIR%
. - It should display the path to your ComfyUI folder.
- Open Command Prompt (
Guide for macOS
-
Open Terminal:
- Use Spotlight (
Cmd + Space
) and search forTerminal
.
- Use Spotlight (
-
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
.
- If it returns
-
Open the appropriate file with a text editor (e.g., nano):
nano ~/.zshrc
or
nano ~/.bash_profile
-
-
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.
- Add the following line to the file:
-
Apply Changes:
- Save the file (
Ctrl + O
, thenEnter
, thenCtrl + X
to exit nano). - Run the following command to apply the changes:
source ~/.zshrc
orsource ~/.bash_profile
- Save the file (
-
Verify:
- Run:
echo $COMFYUI_DIR
It should display the path to your ComfyUI folder.
- Run:
Guide for Linux
-
Open Terminal:
- Use your system’s application launcher to open Terminal.
-
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
.
- If it returns
-
Open the appropriate file with a text editor (e.g., nano):
nano ~/.bashrc
or
nano ~/.zshrc
-
-
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.
- Add the following line to the file:
-
Apply Changes:
- Save the file (
Ctrl + O
, thenEnter
, thenCtrl + X
to exit nano). - Run the following command to apply the changes:
source ~/.bashrc
orsource ~/.zshrc
- Save the file (
-
Verify:
- Run:
echo $COMFYUI_DIR
It should display the path to your ComfyUI folder.
- Run:
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.
Leave a comment
Log in with itch.io to leave a comment.