Quick Start
This page gets you from nothing to a live CIDER session in a few minutes. It sticks to the common happy path - a local Clojure project and Emacs on the same machine. Everything here is covered in more depth elsewhere, and the page links out at each step.
1. Install CIDER
CIDER is available on all the major package.el repositories. The quickest way
in:
M-x package-install <RET> cider <RET>
If Emacs can’t find the package, refresh the package list first with M-x package-refresh-contents <RET> and try again.
For use-package, pinning to stable releases, and the finer points, see
Installation.
|
You’ll also need Emacs 28.1+ and a recent build tool on your PATH - the Clojure
CLI (clojure), Leiningen (lein), or Gradle. Any Clojure project managed by
one of those works out of the box.
2. Open a file in your project
Visit any Clojure source file that belongs to your project (for example
src/my_app/core.clj). CIDER keys off the project that file lives in, so it’s
important to start from inside a real project rather than a stray buffer.
cider-mode turns on automatically in Clojure buffers once CIDER is loaded, and
it’s what adds all the "talk to a running Clojure" commands on top of ordinary
editing.
3. Jack in
Start a REPL and connect to it in one step:
M-x cider-jack-in RET
In a Clojure buffer this is bound to C-c C-x C-j C-j. CIDER detects your build tool, launches an nREPL server with the right dependencies injected automatically, waits for it to come up, and connects. When it’s done you land in a REPL buffer with a prompt.
| If you pause after C-c C-x, a menu pops up listing every way to start or connect to a session, so you don’t have to memorize the key sequences. |
If your REPL server is already running, or lives on another machine or in
a container, use cider-connect instead - see
Up and Running and
Remote and Container Connections.
|
4. Evaluate some code
You now have a running Clojure process you can interact with without ever restarting it. From your source buffer:
-
C-x C-e (
cider-eval-last-sexp) - evaluate the expression right before the cursor and show the result in the echo area. -
C-c C-c (
cider-eval-defun-at-point) - evaluate the top-level form the cursor is in. Use this after editing a function to redefine it in the running program. -
C-c C-k (
cider-load-buffer) - load the whole current buffer.
Try changing a function, pressing C-c C-c on it, and calling it from the REPL - the new definition is live immediately. That loop, editing a running program instead of restarting it, is the heart of how you work with CIDER.
| The REPL buffer is a full Clojure REPL. Type an expression at the prompt and press RET to evaluate it. |
Where to next?
You’re up and running. A few good directions from here:
-
Understand the workflow you just used in Interactive Programming and Using cider-mode.
-
Go deeper on evaluation in Code Evaluation and the REPL in Using the REPL.
-
Configure CIDER to your liking.
-
Explore the additional packages that pair well with CIDER.