Create local Emacs package repository so package upgrade never breaks.
Only installed packages will be packaged into the local repository.
Please note:
- CLI program tar is required
- Since v2.1.1, only Emacs 24.4 and higher versions are supported
- Only way to get a setup never breaks because Emacs Lisp compile file (*.elc) from one version of Emacs might not be compatible with other version of Emacs
- 15 seconds to install 115 packages
- The repository could be hosted on USB/Dropbox/GitHub, so you can install packages behind corp firewall
- Tested with Emacs v24.4, v24.5, v25.3, v26, v27 on OSX/Cygwin/Windows/Linux
- Download elpa-mirror.el to somewhere (say “~/.emacs.d/site-lisp/elpa-mirror”)
- Add below code into your ~/.emacs,
(add-to-list 'load-path "~/.emacs.d/site-lisp/elpa-mirror")
(require 'elpa-mirror)
If you use native Windows Emacs, you need install Cygwin or MSYS2.
Installation is optional, you can running elpa-mirror.el
directly as a independent script. Check the section “Tips”.
M-x elpamr-create-mirror-for-installed
to create local repository.
To use the repository. Say it’s “~/myelpa”, insert below code into your ~/.emacs
,
# myelpa is the ONLY repository now, dont forget trailing slash in the directory
(setq package-archives '(("myelpa" . "~/myelpa/")))
To update an existing local repository after installing new packages from elsewhere, simply rerun the M-x elpamr-create-mirror-for-installed
command again.
BTW, you can run elpa-mirror.el
as a independent script out of Emacs. Check “Create repository in Shell” in “Tips” section.
(setq elpamr-default-output-directory "~/myelpa")
You don’t need install elpa-mirror
if running it in shell,
mkdir -p ~/myelpa && emacs --batch -l ~/.emacs.d/init.el -l ~/any-directory-you-prefer/elpa-mirror.el --eval='(setq elpamr-default-output-directory "~/myelpa")' --eval='(elpamr-create-mirror-for-installed)'
Insert below code into .emacs:
;; all-to-list will not override default elpa.
;; So now you have two repositories.
;; One is GNU elpa. Another is myelpa
(add-to-list 'package-archives
'("myelpa" . "https://dl.dropboxusercontent.com/u/858862/myelpa/"))
My repository is https://github.com/redguardtoo/myelpa.
Insert below code into .emacs:
(add-to-list 'package-archives
'("myelpa" . "https://raw.githubusercontent.com/redguardtoo/myelpa/master/"))
- Insert
(setq elpamr-debug t)
into ~/.emacs - Reproduce bug and report at https://github.com/redguardtoo/elpa-mirror