6

Fresh install of Ubuntu 20.04 Added openjdk-11 and lein 2.9.3

$ sudo apt-add-repository ppa:kelleyk/emacs

Installed GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.14) of 2020-03-26, modified by Debian

Tried the instructions on the cider Getting Started page

M-x package-refresh-contents
M-x package install <RET>
cider <RET>

The cider package isn't found. Tried to package-list-packages - list doesn't contain cider. What am I missing?

Finally did the steps from the following link to get it to work Brave Clojure book companion repo

Gishu
  • 134,492
  • 47
  • 225
  • 308
  • 1
    what is the value of `package-archives`? does it contain melpa? – Rorschach Apr 27 '20 at 02:51
  • @Rorschach - your question sent me on a quest on how to print that variable >> M-: >> M-x ielm and finally to solve the problem – Gishu Apr 27 '20 at 14:26

4 Answers4

11

Not sure why the cider instructions don't mention this.

You need to create a ~/.emacs.d/init.el file with the following contents

(require 'package)

(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/") t)

(package-initialize)

(when (not package-archive-contents)
  (package-refresh-contents))

Save and restart emacs.

M-x package-list-packages check the archive column shows packages from gnu as well as melpa archives.

  • Sometimes you would see an error Failed to download ‘gnu’ archive. - this one is a flaky one. A restart and/or M-x package-refresh-contents fixed it for me.

Now we have the sources configured correctly.

  1. Install: M-x package-install <RET> cider <RET>

  2. M-x package-list-packages - Move to the end of the listing to see Status=installed packages.

  3. Test: M-x cider-jack-in. Answer no to the prompt indicating you are not in a clojure project. Soon you should be dropped to a user> prompt - ready to REPL and roll.

Gishu
  • 134,492
  • 47
  • 225
  • 308
0

You may also consider trying out popular existing "bundle setups' like Spacemacs and Prelude Both of which have all the tooling necessary for Clojure development built-in.

BinaryButterfly
  • 18,137
  • 13
  • 50
  • 91
0

Instead of modifying .emacs or init file manually, you can just change the package-archives variable by typing the following:

M-x customize-variable package-archives

By default, you should only have a GNU source set. Go ahead and add Melpa's name and URL (https://melpa.org/packages/) too by clicking INS. Then apply the changes. Next, type the following commands into the terminal:

M-x package-refresh-contents  [RET]
M-x package-install [RET] cider [RET]

You should be all set.

sitanosik
  • 33
  • 5
0

CIDER is available on the two major package.el community maintained repos - MELPA Stable and MELPA.

After adding the following in my ./emacs, i could install CIDER.

(setq package-archives
    '(("Elpa"     . "https://elpa.gnu.org/packages/")
      ("Melpa Stable" . "https://stable.melpa.org/packages/")
      ("Melpa"        . "https://melpa.org/packages/")
      ("marmalade" . "http://marmalade-repo.org/packages/"))
    package-archive-priorities
    '(("MELPA Stable" . 10)
      ("GNU ELPA"     . 5)
      ("MELPA"        . 0)))