Tuesday, July 9, 2013

How to install MELPA in GNU Emacs

MELPA, which stands for "Milkypostman’s Emacs Lisp Package Archive" is a third-party repository for package.el, a package manager for GNU Emacs. Melpa provides hundreds of third-party Emacs lisp extensions like haskell-mode, scion, and themes. Installing it can be a pain, especially since MELPA's installation tutorial is incomplete. Here are the steps for using MELPA.

 1. Modify emacs.d
 There is a file, called init.el, that dictates what Emacs does when you start it. However, the preferred method of installing MELPA is to create (or modify) your .emacs file in $HOME. Create the .emacs file and put these contents into it:

(require 'package)
(add-to-list 'package-archives
  '("melpa" . "http://melpa.milkbox.net/packages/") t)

If 'package is already (required), do not require it again.

2. List the Packages
The step that the official guide leaves out is the command M-x list-packages. This is similar to what "apt-get update" would do. It will read in the possible packages that are candidates for installation. Now you can install packages with package-install [Ret].

No comments:

Post a Comment