Establish a Clojure environment by installing the following tools:
|Clojure CLI tools||Essential||Run Clojure REPL for development and production|
|Aliases for CLI tools||Recommended||Additional tools to enhance Clojure development experience|
|clj-kondo||Recommended||Static analysis of code to find all those little bugs|
|rlwrap||Optional||A simple read line for command history, only used by
Aliases provided by practicalli/clojure-deps-edn
practicalli/clojure-deps-edn provides a user wide configuration of over 30 aliases to support Clojure devlopment. These aliases use meaningful names to avoid clashes with project specific aliases, ensuring that the user wide aliases remain available in all projects.
Clojure CLI tools
Clojure CLI tools provides the simplest way to run the Clojure REPL and Clojure projects.
Use the Linux script installer from Clojure.org
curl -O https://download.clojure.org/install/linux-install-220.127.116.111.sh chmod +x linux-install-18.104.22.1681.sh sudo ./linux-install-22.214.171.1241.sh
If required, install
sudo apt install curl
The installation creates
/usr/local/bin/clj wrapper and
Open a terminal window and run the
brew command line to install Clojure from the official clojure/tools tap:
brew install clojure/tools/clojure
For Windows 10 use Windows Subsystem for Linux and Windows Terminal are recommended if you have administrative privileges and are happy to use a Unix system on the command line.
Follow the scoop-clojure install instructions, summarized here:
scoop install git scoop bucket add java scoop bucket add scoop-clojure https://github.com/littleli/scoop-clojure scoop install adoptopenjdk-lts-hotspot scoop install clojure scoop update clojure
To also use scoop to install clj-kondo
scoop bucket add extras scoop install clj-kondo
An early release version of clj on Windows is available.
Clojure CLI tools and common aliases
practicalli/clojure-deps-edn contains aliases for a number of community tools that support the Clojure development workflow.
Clone repository to
~/.clojure/, using a fork if you wish to maintain your own aliases
git clone email@example.com:practicalli/clojure-deps-edn.git ~/.clojure/
All tools are provided via libraries and installed on first use, or if library versions are updated.
If using your own
~/.clojure/deps.edn then add an alias for the clj-new tool as this is extensively used in this guide.
clj-kondo static analyser / linter
clj-kondo will greatly enhance the joy of coding in Clojure by keeping your code idiomatic and free from a wide range of syntax bugs. It performs static analysis on Clojure, ClojureScript and EDN, without the need of a running REPL.
Follow the clj-kondo install guide for your operating system.
Spacemacs integration requires the
syntax-checking layer and the
clojure-enable-linters variable added to the clojure layer, within the
dotspacemacs-configuration-layers of the
SPC f e d opens the
SPC s s dotspacemacs-configuration-layers RET to jump to that section of the file
clojure-enable-linters variable to the clojure layer
(clojure :variables clojure-enable-linters 'clj-kondo)
SPC f s to save and
SPC q r to restart Emacs and download any additional packages.
clj-kondo has sensible default configuration, however its simple to add your own configuration
Optional: rlwrap readline
rlwrap binary to support the
clj wrapper, which launches a basic repl with command history. This approach is not as useful as using rebel readline.
rlwrap is available with most Linux systems and install instructions should be found by searching for rlwrap in a web browser.