5

I have just started using Melpa, and I installed the first package. The package though goes to the folder

~/Library/Preferences/Aquamacs Emacs/Pakcages/elpa/

but I would prefer if it went to my .emacs.d/packages folder.

Is there a way to do that or is it not advisable for some reason? If not advisable, is there a way to ensure that if I use another computer that I still have that package installed so that the configurations are the same?

This is what I put on my .emacs file to get Melpa working as per this answer

;; Package installation - MELPA
(require 'package) ;; You might already have this line
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/"))
(when (< emacs-major-version 24)
  ;; For important compatibility libraries like cl-lib
  (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line
9

You want to change the variable package-user-dir:

(setq package-user-dir "~/.emacs.d/packages")

Change this setting before calling (package-initialize) or anything involving loading or installing packages, but after (require 'package).

How I found this:

I use Helm, which makes it easy to search through Emacs's functions and variables. I called describe-variable with C-h v and searched for package dir, and the variable came up. Without Helm, I would use the command apropos-variable and search for the same thing.

  • 1
    OK, that was superb! I really appreciate the last paragraph so that I can find my own answers in the future :) – Vivi Sep 14 '15 at 15:04
  • @Vivi You're welcome! apropos is great, it's really a killer feature. To see all the apropos-* commands, try C-h a apropos RET – nanny Sep 14 '15 at 15:09
  • I always use M-x customize-apropos and I love it! I didn't know any others though so I will have a look now. I just installed Helm using Melpa and it went to the desired folder, ty! – Vivi Sep 14 '15 at 15:11

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.