kx allows you to easily build and switch between different Elixir versions. It
supports setting the default (global) Elixir version as well as per-shell or
per-project versions. Everything is self-contained under one directory, by
default $XDG_DATA_HOME/kx (usually $HOME/.local/share/kx).
kx is forked from kiex and has a few key differences:
-
kx focuses on modern Elixirs (support is provided for Elixir 1.7.0 or later, but kx should build any version after Elixir 1.0.0).
-
kx Elixir builds are tied to the version of Erlang/OTP used to build Elixir, and uses that to prevent the use of Elixir builds incompatible with the current version of Erlang/OTP installed.
-
kx installs Elixir releases from
elixir-lang/elixirtarballs. It only usesgitto install branches. Branches can be installed from any repo.
While kx will be familiar to users of kiex, it is different, intentionally so.
# Install to $XDG_DATA_HOME/kx ($HOME/.local/share/kx)
curl -sSL https://raw.githubusercontent.com/halostatue/kx/main/install |
bash -sIf a different directory is preferred it can be installed by specifying
$KX_HOME prior to running bash.
# Install to $HOME/kx
curl -sSL https://raw.githubusercontent.com/halostatue/kx/main/install |
KX_HOME=$HOME/kx bash -sbash3.x+curlerlanggitmake(orgmakeon FreeBSD)openssl# Required to buildjq
kx list [installed]: Shows kx-managed Elixir versionskx list releases: Shows available Elixir releaseskx list branches: Shows available Elixir brancheskx install VERSION [AS]: Installs the given release versionkx reinstall VERSION: Reinstalls the given release versionkx uninstall VERSION: Uninstalls the given release versionkx use VERSION: Uses the given version for this shellkx shell VERSION: Uses the given version for this shellkx source VERSION: Prints the script to load for this versionkx default VERSION|--clear: Manages the default Elixir versionkx doctor: Checks whether kx can be usedkx self update: Downloads and Updates kxkx self destruct: Removes kx and all installed Elixirs
KX_HOME: Set this to a different directory to use instead of$XDG_DATA_HOME/kx.KX_OAUTH_TOKEN: A GitHub token to be used for GitHub API requests.
- kx does not build Erlang; it uses the currently active version.
- The same build directory used for every git build (saving space vs keeping build around). At the moment, the build directory for each version's tarball is kept. (This may change.)