I have been trying to install packages ivy, counsel, and swiper on Emacs 27 prelude. Starting Emacs results in the following error:

Warning (initialization): An error occurred while loading ‘/Users/username/.emacs.d/init.el’:

error: Could not create connection to melpa.org:443

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace.

Any ideas on why startup fails?

I was using the following init file as a reference point: https://github.com/sitesonix/emacs-prelude-personal/blob/26dab880d0d096a1f04e81b9ee6ba470563aef8f/rtg-init.el.


2 Answers 2


You may have to just use http instead of https

Here is what I have (essentially removed the s from https)

Not the perfect solution but something to get me going.

(setq package-enable-at-startup nil)
(add-to-list 'package-archives
         '("melpa" . "http://melpa.org/packages/"))
 (add-to-list 'package-archives
         '("gnu" . "http://elpa.gnu.org/packages/"))
;; (add-to-list 'package-archives
;;       '("melpa3" . "http://www.mirrorservice.org/sites/stable.melpa.org/packages/"))
;; Package.el stuff

When installing newer Emacsen via Homebrew, use the gnutls switch:

brew reinstall emacs --HEAD --with-gnutls

Source: https://lists.gnu.org/archive/html/bug-gnu-emacs/2014-12/msg00439.html

  • Note that you can accept your own answers.
    – Basil
    Mar 27, 2018 at 0:26
  • Just wanted to add that one can also install gnutls without reinstalling emacs. For example via sudo apt-get install gnutls-bin
    – rex123
    Oct 25, 2021 at 12:39

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.