9

Is this something that can / should be done? For example, often I use emacs in my user account and sometimes root account. When using the package manager (i.e marmalade or something) do I have to install the same packages seperately for each account? It seems to me that they get installed in your home directory.

6

As pointed out by Nsukami, package.el does support system-wide packages. But as your subsequent question points out, it does not provide any special help to install packages in a system-wide manner.

One way you can do that is by using something like:

(setq package-user-dir "/usr/share/emacs/site-lisp/elpa")

in your root account's ~/.emacs. This will make the root user's installed packages available to all users (since /usr/share/emacs/site-lisp/elpa should normally appear in the default value of package-directory-list).

  • Yes this makes sense! Great help guys - thanks. – user2237076 Oct 21 '15 at 14:25
2

According to the documentation:

package-directory-list's value is
("/usr/local/share/emacs/24.4/site-lisp/elpa" "/usr/local/share/emacs/site-lisp/elpa" "/usr/share/emacs/24.4/site-lisp/elpa" "/usr/share/emacs/site-lisp/elpa")

This variable may be risky if used as a file-local variable.

Documentation: List of additional directories containing Emacs Lisp packages. Each directory name should be absolute.

These directories contain packages intended for system-wide; in contrast, `package-user-dir' contains packages for personal use.

You can customize this variable.

This variable was introduced, or its default value was changed, in version 24.1 of Emacs.

Another documentation:

In addition to package-user-dir, Emacs looks for installed packages in the directories listed in package-directory-list. These directories are meant for system administrators to make Emacs packages available system-wide; Emacs itself never installs packages there.

So, for site wide install, I suggest you to, as a system administrator, manually install the packages inside /usr/local/share/emacs/site-lisp/elpa. Or you can also do as suggested by @Stefan

  • Thanks for your reply. I can confirm on inspection of package-directory-list value it is as you have described and indeed package-user-dir is the .emacs.d/elpa folder - where the packages are currently being installed. So I ask then do I override the package-user-dir to point to the global location, or when using for example 'M-x package-install' how can I tell it I want a site wide installation? – user2237076 Oct 21 '15 at 12:50

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.