5.1 Installing package

The :ensure keyword makes use-package ask the Emacs package manager to install a package if it is not already present on your system.

For example:

(use-package magit
  :ensure t)

If you need to install a different package from the one named by use-package, you can use a symbol:

(use-package tex
  :ensure auctex)

You can customize the user option use-package-always-ensure to a non-nil value if you want this behavior to be global for all packages:

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

You can override the above setting for a single package by adding :ensure nil to its declaration.