Install Clojure CLIλ︎
Install the Clojure CLI which provides the essential tools for Clojure development.
The Clojure CLI automatically downloads all library dependencies, including the Clojure Standard library. As Clojure itself is packages as a library (.jar
Java ARchive), any version of Clojure can be used with a project.
Practicalli Clojure CLI Config extends the Clojure CLI with a range of development tools as well as configuration for Clojure LSP and cljstyle code format tool.
Practically recommends setting XDG_CONFIG_HOME
to the .config
directory, to avoid creating another dot directory in the root of the user account. Add the following to ~/.bashrc
for the bash shell or ~/.zshenv
for Zsh.
Use the Linux script installer from Clojure.org - Getting Started to install the latest stale release
curl -O https://download.clojure.org/install/linux-install.sh && \
chmod +x linux-install.sh && \
sudo ./linux-install.sh
The installation creates /usr/local/bin/clojure
, /usr/local/bin/clj
wrapper and /usr/local/lib/clojure
directory.
Include version number for specific release
Clojure CLI linux install scripts include a number in their name to signify the version of Clojure and the version of Clojure CLI.
Include the version in the script name for repeatable environments, e.g. in Dockerfile configuration and Continuous Integraion workflows.
Practically recommends setting XDG_CONFIG_HOME
to the .config
directory, to avoid creating another dot directory in the root of the user account. Add the following to ~/.bashrc
for the bash shell or ~/.zshenv
for Zsh.
Use the Homebrew command with the clojure/tools tap, as defined in the Clojure.org Getting started guide
Use Homebrew to update an install of Clojure CLI to the latest release
For Windows 10 use Windows Subsystem for Linux and Windows Terminal are recommended if you have administrative privileges and are comfortable using a Unix system on the command line.
Alternatively install scoop.sh, a command line installer for windows. Powershell 5 or greater is required. Follow the scoop-clojure getting started guide, summarized here:
Open "Windows PowerShell" and enter the following commands to configure the shell:
Then in the same PowerShell window, install the Clojure related tools using the following commands:Reference: Clojure CLI Install - Clojure.org Getting Started - official guide
Practicalli Clojure CLI Configλ︎
Add a wide range of community tools to extend the capabilities of Clojure CLI via the aliases contained within Practicalli Clojure CLI configuration.
Fork or clone Practicalli Clojure CLI Config GitHub repository, first removing the $XDG_CONFIG_HOME/clojure
or $HOME/.clojure
directory if they exist.
Check Clojure CLI configuration location
Check the location of your Clojure configuration directory by running clojure -Sdescribe
and checking the :user-config
value.
If XDG_CONFIG_HOME
environment variable is set, clone the repository to $XDG_CONFIG_HOME/clojure
Via SSH
Via HTTPS:
Clojure CLI will look for its configuration in $HOME/.clojure
directory if $XDG_CONFIG_HOME
and CLJ_CONFIG
environment variables not set.
Via SSH
```shell
git clone git@github.com:practicalli/clojure-deps-edn.git $HOME/.clojure
```
Via HTTPS
```shell
git clone https://github.com/practicalli/clojure-deps-edn.git $HOME/.clojure
```
Check Configurationλ︎
clojure -Sdescribe
shows the version of Clojure CLI installed and configuration locations used.
The output of the command includes the version of Clojure CLI in the :version
key
{:version "1.11.1.1208"
:config-files ["/usr/local/lib/clojure/deps.edn" "/home/practicalli/.config/clojure/deps.edn" ]
:config-user "/home/practicalli/.config/clojure/deps.edn"
:config-project "deps.edn"
:install-dir "/usr/local/lib/clojure"
:config-dir "/home/practicalli/.config/clojure"
:cache-dir "/home/practicalli/.cache/clojure"
:force false
:repro false
:main-aliases ""
:repl-aliases ""}
clojure -Sversion
will shows the version of Clojure CLI being when theclojure
command is used to run a REPL or other Clojure command.
Optional rlwrap readlineλ︎
The rlwrap
binary is a basic readline tool that provides a history of commands entered into a terminal UI when running a Clojure REPL with the clj
wrapper script.
Pressing the Up and Down keys will scroll through the code previously entered in the REPL.
rlwrap
is available with most Linux systems. Look for install instructions by searching for rlwrap in a web browser or build from source from the rlwrap GitHub repository.
Use Rebel Readline for a rich terminal UI experience
rebel readline provides a auto-completion, documentation, signature help and multi-line editing all within a terminal UI, providing a much richer experience than the clj
wrapper and rlwrap
.
Rebel Readline is part of the Practicalli Clojure CLI config.