Linux Guide

Installation

You can install xonsh using conda, pip, or from source.

conda:

$ conda config --add channels conda-forge
$ conda install xonsh

pip:

$ pip install xonsh

source: Download the source from github (zip file), then run the following from the source directory,

$ python setup.py install

Debian/Ubuntu users can install xonsh from the repository with:

apt:

$ apt install xonsh

Fedora users can install xonsh from the repository with:

dnf:

$ dnf install xonsh

Arch Linux users can install xonsh from the Arch User Repository with:

yaourt:

$ yaourt -Sa xonsh

aura:

$ aura -A xonsh

pacaur:

$ pacaur -S xonsh

Note that some of these may require sudo. If you run into any problems, please let us know!

Dependencies

Xonsh currently has the following external dependencies,

Run Time:

  1. Python v3.4+
  2. PLY (optional, included with xonsh)

Pip supports “extra” dependencies in the form of xonsh[ptk,linux], where the list in the brackets identify the optional features

Xonsh currently has the following extras

  1. ptk: prompt-toolkit: advanced readline library, line-editing
  2. pygments: syntax-highlighting
  3. proctitle: setproctitle: change the title of terminal to reflect the current subprocess
  4. linux: distro: linux specific platform information
  5. mac: gnureadline: GNU’s featureful version of readline
  6. win: win_unicode_console: enables the use of Unicode in windows consoles

In addition, xonsh integrates with Jupyter, an in-browser REPL, enabling the use of xonsh in jupyter notebooks

Development Dependencies

If you want to develop xonsh, it is extremely recommended to install the dependencies listed in requirements-docs.txt (to generate documentation) and requirements-tests.txt (to run the test suite).

Customization

See the xonsh customization guide for more details on setting up xonsh!

Possible conflicts with Bash

Depending on how your installation of Bash is configured, Xonsh may have trouble loading certain shell modules. Particularly if you see errors similar to this when launching Xonsh:

bash: module: line 1: syntax error: unexpected end of file
bash: error importing function definition for `BASH_FUNC_module'
bash: scl: line 1: syntax error: unexpected end of file
bash: error importing function definition for `BASH_FUNC_scl'
bash: module: line 1: syntax error: unexpected end of file
bash: error importing function definition for `BASH_FUNC_module'
bash: scl: line 1: syntax error: unexpected end of file
bash: error importing function definition for `BASH_FUNC_scl'

...You can correct the problem by unsetting the modules, by adding the following lines to your ~/.bashrc file:

unset module
unset scl

Default Ubuntu .bashrc breaks Foreign Shell Functions

Xonsh supports importing functions from foreign shells using the ForeignShellFunctionAlias class, which calls functions as if they were aliases. This is implemented by executing a command that sources the file containing the function definition and then immediately calls the function with any necessary arguments.

The default user ~/.bashrc file in Ubuntu 15.10 has the following snippet at the top, which causes the script to exit immediately if not run interactively.

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

This means that any function you have added to the file after this point will be registered as a xonsh alias but will fail on execution. Previous versions of Ubuntu have a different test for interactivity at the top of the file that yields the same problem.