Xonsh Installation General Guide¶
**The guide is new so in case of error please open the issue in the tracker.
Important¶
Xonsh is a full-featured shell and can technically be used as a login shell,
but since it is not a POSIX‑compatible shell, we don’t recommend doing
so unless you clearly understand the purpose and consequences.
Do not attempt to set it as your default shell using chsh
or by any other method that would replace the system shell.
The recommended practice is to create a Xonsh profile in your terminal emulator.
Overview¶
Xonsh is a Python-based shell that requires Python to be packaged, preinstalled or compiled in order to run. Since there are many ways to install Python, there are also many ways to run xonsh. The table describes the main approaches and their advantages.
Use as core shell |
Isolated env |
Fresh version |
Automation |
Portable |
|
|---|---|---|---|---|---|
Independent install |
✓ |
✓ |
✓ |
||
PyPi package |
✓ |
✓ |
|||
AppImage |
~ |
✓ |
✓ |
||
Conainer |
✓ |
✓ |
✓ |
||
Platform package |
Work in progress: binary build, running in RustPython.
Independent install¶
When xonsh is used as a core shell, it is necessary to keep the Python environment with xonsh
stable, predictable, and independent of system changes. Lightweight environment managers
such as venv, pipx, or rye do not fully address this requirement.
Package managers that can install fully isolated Python environments as a core feature,
such as Miniconda or Micromamba, should be used.
Install xonsh with Micromamba:
TARGET_DIR=$HOME/.local/xonsh-env PYTHON_VER=3.11 XONSH_VER='xonsh[full]' \
/bin/bash -c "$(curl -fsSL https://xon.sh/install/mamba-install-xonsh.sh)"
Learn more: Mamba installer.
PyPi package¶
You can install xonsh package from PyPi using an existing installation of pip, pipx, rye, etc.
pip:
pip install 'xonsh[full]'
Pip can also install the most recent xonsh source code from the xonsh project repository:
pip install 'https://github.com/xonsh/xonsh/archive/main.zip#egg=xonsh[full]'
conda:
conda config --add channels conda-forge
conda install xonsh
AppImage¶
Xonsh is available as a single AppImage bundled with Python, allowing you to run it on Linux without installation:
wget 'https://github.com/xonsh/xonsh/releases/latest/download/xonsh-x86_64.AppImage' -O xonsh
chmod +x xonsh
./xonsh
Study how to package your libraries in Xonsh AppImage article.
Container¶
Xonsh publishes a handful of containers, primarily targeting CI and automation use cases. All of them are published on Docker Hub.
Example of running an interactive xonsh session in a container:
docker run --rm -it xonsh/interactive
Learn more: Containers.
Platform package¶
Various operating system distributions provide platform-specific package managers that may offer a xonsh package. This approach is not recommended for the following reasons:
On non-rolling-release operating systems, the xonsh version is often outdated and may lack important dependencies.
System package managers install xonsh into the system Python environment, which means that any significant system update or change has a high probability of breaking the shell.
Arch Linux:
pacman -S xonsh # not recommended but possible
Debian/Ubuntu:
apt install xonsh # not recommended but possible
Fedora:
dnf install xonsh # not recommended but possible
GNU guix:
guix install xonsh # not recommended but possible
OSX:
brew install xonsh # not recommended but possible
WIP Binary build¶
Using Nuitka (a Python compiler), it is possible to build a binary version of xonsh. Learn more in xonsh/2895.
WIP RustPython build¶
Using RustPython (a Python Interpreter written in Rust), it is possible to run xonsh using Rust. Learn more in xonsh/5082.