Skip to content

Instantly share code, notes, and snippets.

@mlabbe
Created June 29, 2025 14:53
Show Gist options
  • Save mlabbe/ca84d1711d5349c3a4067d85e6484a61 to your computer and use it in GitHub Desktop.
Save mlabbe/ca84d1711d5349c3a4067d85e6484a61 to your computer and use it in GitHub Desktop.
Update Emacs packages on the command line
#!/bin/sh
emacs --batch -l ~/.emacs \
--eval="(progn (require 'package) \
(package-initialize) \
(package-refresh-contents) \
(mapc (lambda (pkg)
(let* ((new (cadr (assq pkg package-archive-contents)))
(installed (cadr (assq pkg package-alist))))
(when (and new installed
(version-list-< (package-desc-version installed)
(package-desc-version new)))
(package-install new))))
(mapcar 'car package-alist)))"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment