I tried to install emacs and in an attempt to install MELPA, tried:

(this is my init.el file)

(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/"))

(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
                    (not (gnutls-available-p))))
       (proto (if no-ssl "http" "https")))
  (add-to-list 'package-archives
               (cons "melpa" (concat proto "://melpa.org/packages/")) t))

When I tried running the following commands M-x package-initialize then M-x package-refresh-contents, it said that it Failed to download 'gnu' archive. Is there anyway of getting around this?

I'm using MacOS and using emacs version 26.2.


Add the following before package-initialize:

(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")

This is apparently a bug in Emacs 26.2 for MacOS. I found this solution in this reddit thread.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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