package.el
Before you can install packages from a MELPA channel, you have
to add a entry to the variable package-archives,
in your init file (usually ~/.config/emacs/init.el)
as shown below.
If you are using a very old Emacs release, you might have to
prefix that with (require 'package).
We strongly recommend using a channel that ships snapshots of development versions, not a channel that ships upstream releases. Using just releases is appealing, because that way you will be affected by fewer regressions. Unfortunately many package maintainers have stopped creating releases, so for their packages, sticking to the latest release, often means using a version with known bugs, which have been fixed many years ago on the "development" branch. In practice you won't get a more stable experience by using the "stable" channel.
Since July 2026 we offer two experimental channels, which are intended to eventually replace the "regular" MELPA channel and the MELPA Stable channel: MELPA Snapshots and MELPA Releases.
Like "regular" MELPA, MELPA Snapshots ships snapshots build from the default branches of upstream repositories. Like MELPA Stable, MELPA Releases ships packages build from the latest upstream releases.
MELPA Stable uses only git/mercurial tags to determine the
latest release. If there are no release tags, MELPA Releases
also considers the Version library header, and if
that is also unset, it uses the stand-in 0.0,
which means that all package distributed on MELPA Snapshots
are also distributed on MELPA Releases.
The new MELPA Snapshots channel uses better version strings
than the "regular" MELPA channel. The new version string
format is RELEASE.0.DATE.COUNT, while the old
format is just DATE.TIME. RELEASE
is the version shipped on the MELPA Releases channel.
To learn more about the new experimental channels, see their announcement.
It should be safe to use the new, experimental MELPA Snapshots channel, but if you want to play it safe, stick to "regular" MELPA for now.
To use the
"regular" MELPA channel, add this to your init file and evaluate it.
Then run M-x package-refresh-contents to fetch the package
definitions.
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
To use the
MELPA Stable channel, add this to your init file and evaluate it.
Then run M-x package-refresh-contents to fetch the package
definitions.
(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
To use the
MELPA Snapshots channel, add this to your init file and evaluate it.
Then run M-x package-refresh-contents to fetch the package
definitions.
(add-to-list 'package-archives '("melpa-snapshots" . "https://snapshots.melpa.org/packages/") t)
To use the
MELPA Releases channel, add this to your init file and evaluate it.
Then run M-x package-refresh-contents to fetch the package
definitions.
(add-to-list 'package-archives '("melpa-releases" . "https://releases.melpa.org/packages/") t)
Once you have added a MELPA channel as shown above and then
ran M-x package-refresh-contents to fetch the
package definitions, you can install a package using
M-x package-install.
See Package Installation for details about that and Emacs Lisp Packages for even more information about Emacs' package manager.
What if you only want some of your packages to be installed from MELPA, and the rest from GNU ELPA, NonGNU ELPA, or some other ELPA?
The variable package-pinned-packages
allows you to exclude or include versions according to their
source. For users using older versions of Emacs, we provide
a package-filter.el package (available in MELPA)
that will allow you to enable only certain packages or exclude
certain packages. You can install the package manually by
pasting this into your *scratch* buffer and
evaluating it.
(progn
(switch-to-buffer
(url-retrieve-synchronously
"https://raw.github.com/melpa/package-filter/master/package-filter.el"))
(package-install-from-buffer (package-buffer-info) 'single))
You can then customize two variables:
package-archive-enable-alist
Optional Alist of enabled packages used
by package-filter. The format
is (ARCHIVE . PACKAGE ...),
where ARCHIVE is a string matching an archive
name inpackage-archives, PACKAGE
is a symbol of a package in ARCHIVE to
enable.
If no ARCHIVE exists in the alist, all
packages are enabled.
package-archive-exclude-alist
Alist of packages excluded by package-filter.
The format is (ARCHIVE . PACKAGE ...), where
ARCHIVE is a string matching an archive name
in package-archives, PACKAGE is
a symbol of a package in that archive to exclude.
Any specified package is excluded regardless of the value
of package-archive-enable-alist
This occasionally happens when using Emacs <= 26.2 with Gnutls >= 3.6. The recommended fix is to update to Emacs 26.3 or greater. Alternatively you can disable TLS1.3 by adding the following setting early in your init file. For more information see Emacs bug#34341.
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
There is a small bug in Emacs 24’s package.el such
that the dependency order comes out backwards. The problem is
patched by some advice.
(defadvice package-compute-transaction
(around package-compute-transaction-fix activate)
"Fix order of requirements."
(let ((package-list (ad-get-arg 0)))
(let (package-list)
(ad-set-args 0 (list nil (ad-get-arg 1)))
ad-do-it)
(dolist (elt (nreverse ad-return-value))
(setq package-list (cons elt (delq elt package-list))))
(setq ad-return-value package-list)))
After running package-list-packages,
type U (mark Upgradable packages) and then x
(eXecute the installs and deletions). When it’s done
installing all the packages it will ask if you want to delete
the obsolete packages and so you can hit y (Yes).
If you run into a problem installing or upgrading, you may
need to go into your ~/.emacs.d/elpa/ directory
and delete packages that are installed multiple times. This
can happen when the install times out.
Fork the melpa/melpa repository. Add a recipe for your package, as described in the README.md file on GitHub.
Development happens mostly in the
package-build
repository.