Where Does Xonsh Store Config and History?
Xonsh reads ~/.xonshrc plus the XDG rc.xsh file, with history in the XDG data dir as JSON or SQLite.
Last updated
Xonsh splits startup across two user files. The classic ~/.xonshrc runs for interactive sessions and holds prompt and alias setup. The XDG file at ~/.config/xonsh/rc.xsh runs for every session, scripts included. System defaults live in /etc/xonsh/xonshrc, with drop in directories beside both.
History lives apart in the XDG data dir, as dated JSON files by default or one SQLite file on the SQLite backend. Point XONSH_DATA_DIR elsewhere to relocate it. The static config.json in the XDG config dir sets env before either rc file runs.
Where Xonsh stores this, by platform
~/.config/xonsh/rc.xsh
Runs for all session types. Drop in scripts go in rc.d beside it. History defaults to JSON files under the XDG data dir xonsh folder.
~/.config/xonsh/rc.xsh
Same XDG layout as Linux. System file differs per platform, while the user rc and history paths stay in home.
Frequently asked questions
Should config go in xonshrc or rc.xsh?
Edit ~/.xonshrc for interactive settings. The XDG rc.xsh runs for every session type including scripts, so keep scripting setup there and prompt setup in xonshrc.
How do I switch Xonsh history to SQLite?
Set XONSH_HISTORY_BACKEND to sqlite in the rc file. JSON keeps command output per entry, while SQLite skips output and the history diff action.
Is there a setup wizard for Xonsh?
Run the xonfig wizard from a xonsh prompt. It writes tagged lines to the rc file without wiping custom edits, and offers a web UI variant.
Notice an outdated path? Let us know.