Create local emacs package repository. 15 seconds to install 115 packages.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.org documentation Mar 1, 2018
elpa-mirror-pkg.el supports Emacs v26, clean code Jan 14, 2018
elpa-mirror.el documentation Mar 1, 2018
pkg.sh supports Emacs v26, clean code Jan 14, 2018

README.org

elpa-mirror (v2.1.1)

http://melpa.org/packages/elpa-mirror-badge.svg http://stable.melpa.org/packages/elpa-mirror-badge.svg

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 and cp is required
  • Since v2.1.1, only Emacs 24.4 and higher versions are supported

Why

  • The only way to get a setup never breaks
  • 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

Install

  • 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.

Usage

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.

Tips

Change output directory,

(setq elpamr-default-output-directory "~/myelpa")

Create repository in Shell

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)'

Repository on Dropbox

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/"))

Repository on GitHub

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/"))

Report bug