0

On Mac OS, Emacs 28.2, I have the following lines at the top of my init.el

(require 'package)

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

(unless package-archive-contents
  (package-refresh-contents))

(package-initialize)

But when I run M-x package-list-packages, I don't see any package from MELPA. Under the column "Archive", I only see gnu or nongnu. Running M-x package-refresh-contents doesn't help. I get no error at startup and the file emacs.d/elpa/archives/melpa/archive-contents exists.

I am trying to install some MELPA packages like quelpa, but something seems broken. What is the fix?

1
  • 3
    As @shynur points out in the answer, you are using add-to-list incorrectly. Do C-h f add-to-list to read its doc string: that would alert you to the fact that you can only use it to add one element at a time. Emacs provides documentation at your fingertips, but you have to learn how to use that facility. Do C-h C-h and explore!
    – NickD
    Commented Apr 24, 2023 at 14:15

1 Answer 1

4

See the official website of MELPA:

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

Did you notice that it uses HTTPS?


Also, see add-to-list:

(add-to-list LIST-VAR ELEMENT &optional APPEND COMPARE-FN)

You're using the wrong invocation.


Add these repositories separately:

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

@vpk: please see here:

enter image description here

6
  • Thanks, this works! But I still don't see quelpa in the list of packages. Not sure why?
    – vpk
    Commented Apr 24, 2023 at 15:18
  • @vpk: Repositories GNU and NonGNU go with Emacs distribution; others do not. So you need to add them manually (just like how you add Org and MELPA). If you want to use quelpa, you should take a look at its official website and see what URL it provides.
    – shynur
    Commented Apr 24, 2023 at 15:26
  • The reason I'm expecting to see quelpa is because quelpa's documentation states that it is provided by melpa, see here github.com/quelpa/quelpa#installation
    – vpk
    Commented Apr 24, 2023 at 16:34
  • @vpk: It seems that quelpa is a package which can be downloaded at MELPA, not a repository. See my updated answer (wait for a minute).
    – shynur
    Commented Apr 24, 2023 at 16:39
  • yes, i edited the question to clarify that quelpa is a package. I can see tons of melpa-provided packages including quelpa-leaf and quelpa-use-package, but I don't see quelpa like you do in your screenshot. I'm referring to the M-x package-list-packages buffer.
    – vpk
    Commented Apr 24, 2023 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.