5

I'm using use-package in my init.el for all my package installations and configuration. I thought specifying :ensure t in use-package would make sure I always have the latest versions installed. But when I did M-x package-list-packages the minibuffer tells me I have a number of package updates waiting. Isn't it enough to specify :ensure t in use-package, do I have to manually check for and install updates using M-x package-list-packages? What is the best way to handle updates when using use-package?

6

The :ensure option in use-package does not automatically keep packages up to date. It ensures that the package is installed. This might be useful if you pull your Emacs config on to a new machine (or are using it across several machines), because when you start up all your required packages would get installed.

You'll still need to deal with installing updates.

  • 1
    The reason I've heard as to why that's the case is because updating packages can break them, so it would regress in functionality. – zck Mar 31 '17 at 16:58
  • @zck I think it's more that use-package is meant to provide a quick startup and checking for updates would be slow. Also, the author of use-package doesn't use package.el packages, any related features (like :ensure) were tacked on afterwards by other users. In the original design, all packages are considered optional, your init.el just skips configuration of missing packages. – npostavs Mar 31 '17 at 17:57
8

I use auto-package-update to automatically update packages.

(use-package auto-package-update
   :ensure t
   :config
   (setq auto-package-update-delete-old-versions t
         auto-package-update-interval 4)
   (auto-package-update-maybe))

With that setup, packages will be updated every 4 days, and the old packages will be removed.

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.