Skip to main content
ForgeCode ranks #1 on TermBench with 81.8% accuracy.Learn more →

Custom Config Directory

By default, ForgeCode keeps its configuration at ~/forge/ on macOS/Linux and %USERPROFILE%\forge on Windows. That stops working when you want the config in a dotfiles repo, on a different volume, or switched per environment.

FORGE_CONFIG points ForgeCode at a different directory.

What It Controls

When FORGE_CONFIG is unset, ForgeCode reads from ~/forge/.forge.toml.

Set it to a directory path and ForgeCode uses that path instead:

export FORGE_CONFIG=~/.config/forgecode

ForgeCode will look for ~/.config/forgecode/.forge.toml. The directory must exist. If .forge.toml is missing inside, ForgeCode starts with defaults.

When to Change It

Dotfiles repo:

export FORGE_CONFIG=~/.config/forgecode

Multiple environments — switch configs for work vs personal:

export FORGE_CONFIG=~/.config/forgecode-work

Different volume — home directory is full or slow:

export FORGE_CONFIG=/data/forgecode

Setting It

~/.env — ForgeCode-only, persistent:

FORGE_CONFIG=~/.config/forgecode

~/.zshrc — system-wide, persistent:

export FORGE_CONFIG=~/.config/forgecode

Reload after editing: source ~/.zshrc

Current session — temporary:

export FORGE_CONFIG=~/test-config

Verifying the Change

Check the variable:

echo $FORGE_CONFIG

Then run :config-edit in a ForgeCode session. Your editor should open $FORGE_CONFIG/.forge.toml.

Reverting to the Default

unset FORGE_CONFIG

Or remove the line from ~/.zshrc and reload.

Migrating an Existing Config

Move the directory:

mv ~/forge ~/.config/forgecode
export FORGE_CONFIG=~/.config/forgecode

For the full list of settings inside the config file, see the .forge.toml reference.