Is there a way I can install two versions of Emacs on the same machine ? The last time I tried installing versions 24 and 25 neither of the installations was working and the easiest solution was to reinstall the operating system. This is Ubuntu 18.04.

Virtual machine is a solution, of course, but I was wondering how you are dealing with such situations.

The reason for this is I want to try Spacemacs, Emacs26 and different packages without polluting my current setup.

Since my question "appears subjective", answers like "use the virtual machine" would be fine.

  • 7
    I have installed many versions of Emacs because when developing new Emacs packages I need to know if older versions of Emacs are supported as well, I don't use them for any other purpose like yours. I simply download the tarballs and build Emacs, e.g., wget && tar && cd && ./configure && make && src/emacs, I don't need to "install" anything, all built files are kept inside the Emacs source directory. – xuchunyang Apr 6 '19 at 5:46
  • 1
    @xuchunyang Maybe I should try installing it like you, not with sudo apt ... – Bor Apr 6 '19 at 8:32
  • 1
    Alternatively to xuchunyang approach, you could just clone emacs repo and checkout and build the desired version – Jesse Apr 8 '19 at 12:14
  • @Jesse Probably you already know, but: Just be careful not to copypasta an example that has && make install at the end: make install would copy the files into the same default places as apt install would, and "overwrite" the "default" version of emacs. – Greg Hendershott Apr 9 '19 at 13:06
  • @GregHendershott By default make install puts the files under /usr/local/, so it wouldn't conflict with apt installed files. – npostavs Apr 10 '19 at 1:10

You do not need anything as fancy as a virtual environment:

  1. Create a folder (e.g. =mkdir ~/Test; mkdir ~/Test/Emacs26= in a terminal);
  2. Compile (or copying a compiled executable) the version of Emacs that you want to test in it (e.g. =Emacs 26.1=). You might find the instructions from Xah Lee on ErgoEmacs useful (http://ergoemacs.org/emacs/building_emacs_on_linux.html);
  3. Copy your configuration file (e.g. =.emacs=) or folder (e.g. =.emacs.d=) in the same folder;
  4. Open a terminal and launch the new emacs from the command line (e.g. =./bin/emacs= or =~/Test/Emacs26/bin/emacs=), specifying your configuration file via the -q -l options*, because you will probably have to modify it according to the new version of emacs (see https://stackoverflow.com/questions/12407819/how-to-specify-customized-emacs-configuration-file-rather-than-emacs for alternative ways to specify your configuration files)

Learning how to do it, you will even be able to copy emacs (and your configuration file) and be able to run it from a usb key on any linux machine, and even under tails!

Hope it helps, good luck.

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.