Categories
Customization Emacs Tutorial

MELPA for Emacs – Access Thousands of Packages

If you're using Emacs 24 and haven't configured MELPA yet, you're missing out on thousands of community-maintained packages. MELPA (Milkypostman's Emacs Lisp Package Archive) is the largest and most active Emacs package repository, offering bleeding-edge packages that are updated daily from their source repositories.

What is MELPA?

Emacs 24 introduced package.el, a built-in package manager that revolutionized how Emacs users install and manage extensions. By default, Emacs only knows about the official GNU ELPA repository, which contains a relatively small collection of packages that meet strict GNU criteria.

MELPA changes this by providing:

  • Thousands of packages – Community-maintained extensions covering every imaginable use case
  • Daily updates – Packages are built directly from source repositories, so you get the latest features
  • Easy installation – One-command installation via M-x package-install
  • Automatic dependency management – Packages automatically install their dependencies

The Problem

The official GNU ELPA repository is conservative by design. Many popular Emacs packages aren't available there because:

  • They don't meet GNU's copyright assignment requirements
  • They're too experimental or bleeding-edge
  • Authors prefer faster release cycles
  • They're hosted on GitHub rather than GNU infrastructure

This leaves Emacs users manually downloading .el files, managing load paths, and tracking updates themselves—exactly what package managers are meant to solve.

The Solution: Multiple Package Repositories

You can configure Emacs to check multiple package repositories, giving you access to both stable GNU packages and the vibrant MELPA ecosystem.

Configuration

Add this code to your ~/.emacs or ~/.emacs.d/init.el file:

;;;
;;; ELPA
;;;

(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                         ("marmalade" . "http://marmalade-repo.org/packages/")
                         ("melpa" . "http://melpa.milkbox.net/packages/")))

How It Works

This configuration sets up three package repositories:

GNU ELPA (official):

("gnu" . "http://elpa.gnu.org/packages/")

The official GNU Emacs package repository. Contains stable, well-vetted packages that meet GNU's criteria. This is enabled by default in Emacs 24.

Marmalade:

("marmalade" . "http://marmalade-repo.org/packages/")

A community repository that accepts package uploads from any Emacs user. It's more permissive than GNU ELPA but less frequently updated than MELPA.

MELPA:

("melpa" . "http://melpa.milkbox.net/packages/")

The largest and most active repository. Packages are automatically built from their source repositories (usually GitHub), so you get the latest commits. This is where most active development happens.

The setq package-archives line replaces the default repository list with your custom configuration, giving Emacs access to all three sources when you browse or install packages.

Installation

  1. Edit your Emacs configuration file: C-x C-f ~/.emacs RET (Or ~/.emacs.d/init.el if you use that structure)
  2. Add the configuration code shown above
  3. Save the file: C-x C-s
  4. Restart Emacs to load the new configuration
  5. Refresh package list: M-x package-refresh-contents This downloads the package lists from all three repositories
  6. Browse available packages: M-x list-packages

Using the Package System

Once configured, installing packages is simple:

Browse and Install Interactively:

  1. Run M-x list-packages
  2. Browse the list (thousands of packages!)
  3. Press i to mark a package for installation
  4. Press x to execute (install marked packages)

Install by Name:

M-x package-install RET package-name RET

Update Packages:

  1. Run M-x list-packages
  2. Press U to mark all upgradeable packages
  3. Press x to execute updates

Popular Packages to Try

Once MELPA is configured, try these essential packages:

magit – An incredible Git interface that makes version control intuitive and powerful

company-mode – Modern auto-completion framework

projectile – Project navigation and management

helm – Incremental completion and selection framework

markdown-mode – Major mode for editing Markdown files

paredit – Structured editing for Lisp code

auto-complete – Intelligent auto-completion

yasnippet – Snippet expansion system

Install any of these with: M-x package-install RET package-name RET

Benefits

Huge Package Selection: Access thousands of packages instead of the few hundred in GNU ELPA.

Automatic Updates: MELPA packages are rebuilt daily from source, so you get bug fixes and new features quickly.

Easy Installation: No more manually downloading files, managing load paths, or tracking updates.

Dependency Management: Packages automatically install their dependencies—no configuration required.

Discoverability: Browse M-x list-packages to discover packages you didn't know existed.

Notes

Package Priority: When the same package exists in multiple repositories, Emacs uses version numbers to determine which to install. Generally, MELPA versions are newer than Marmalade or GNU ELPA.

Stability vs. Bleeding Edge: MELPA packages are built from the latest source commits. If you prefer stability, you can use MELPA Stable (not shown in this configuration), which only builds from tagged releases.

First-Time Setup: The first time you run package-refresh-contents, it may take a minute to download all the package lists. This is normal—subsequent refreshes are much faster.

Package Management: In the package list buffer, useful keybindings:

  • i – Mark for installation
  • d – Mark for deletion
  • u – Unmark
  • U – Mark all upgradeable packages
  • x – Execute marked actions
  • h – Help

Auto-loading Packages: Installed packages are automatically loaded when Emacs starts. You don't need to add require statements to your .emacs file.

View the original configuration on Gist.

By Shishir Sharma

Shishir Sharma is a Software Engineering Leader, husband, and father based in Ottawa, Canada. A hacker and biker at heart, and has built a career as a visionary mentor and relentless problem solver.

With a leadership pedigree that includes LinkedIn, Shopify, and Zoom, Shishir excels at scaling high-impact teams and systems. He possesses a native-level mastery of JavaScript, Ruby, Python, PHP, and C/C++, moving seamlessly between modern web stacks and low-level architecture.

A dedicated member of the tech community, he serves as a moderator at LUG-Jaipur. When he’s not leading engineering teams or exploring new technologies, you’ll find him on the open road on his bike, catching an action movie, or immersed in high-stakes FPS games.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.