Given a requirements.txt file describing a Python virtual environment, one can run pip install requirements.txt, go for a coffee, then come back to find that the packages in requirements.txt have been installed.

Is there a mechanism in Emacs (25.x, 26.x) to install a list of packages without attending to the installation by running a sequence of M-x package-install?

  • Please pose one, specific question, only. Even your "More briefly" summary question is too broad.
    – Drew
    Dec 25, 2019 at 23:33
  • Maybe you're looking for Cask?
    – Stefan
    Dec 26, 2019 at 15:02

1 Answer 1


One can use use-package. In a file (which could be your init file, but doesn't have to be):

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

(setq package-archives
      (seq-remove (lambda (element)
                    (equal "gnu" (car element)))
(add-to-list 'package-archives
             '("gnu" . "https://elpa.gnu.org/packages/"))

;; bootstrap use-package, so I can use it to manage everything else
(unless (package-installed-p 'use-package)
  (package-install 'use-package))

(eval-when-compile (require 'use-package))

(use-package use-package
  (setq use-package-always-ensure t))

Then you can set up all your packages as follows:

(use-package package1)
(use-package package2)

When this file is evaluated (which, if it's your init file, is on startup), Emacs will install all the packages you've set up this way. If a package is already installed, use-package will skip the installation; it won't be updated to the latest. You can use other features of use-package to configure each installed package.

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.