iBoyko - "sort of" a website

# Updating Emacs from 24 to 26/27 on Ubuntu

## A quick instruction on how to update an existing Emacs intallation from version 24 to version 26 or 27 on Ubuntu 16.

Posted by Yakov Boyko on March 24, 2019

If you have an existing Emacs installation on Ubuntu and would like to update it to the latest version of Emacs available, here is a relatively painless way to do it.

Run these commands


sudo apt-get update
sudo apt install emacs-snapshot


The commands above will add the ubuntu-elisp repository and install the emacs-snapshot. The latter means that the latest Emacs version will be installed. If you would like to hand-pick the version you want, swap the commands for something like this


sudo apt-get update
sudo apt install emacs25

sudo apt-get update
sudo apt install emacs26

Suppose you went with the first version in which you intend to have the latest version installed. As of the time of this writing, it is Emacs 27.0.50.

After running these commands, you may still see something like this if you check the version of Emacs in your terminal

user@user-desktop:~$which emacs /usr/bin/emacs user@user-desktop:~$ emacs -version
GNU Emacs 24.5.1
Copyright (C) 2015 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

To fix this, one needs to reconfigure to which Emacs version the "emacs" command points. To do this, run

sudo update-alternatives --config emacs

You will see something like this

user@user-desktop:~$sudo update-alternatives --config emacs There are 2 choices for the alternative emacs (providing /usr/bin/emacs). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/emacs24-x 27 auto mode 1 /usr/bin/emacs-snapshot 27 manual mode 2 /usr/bin/emacs24-x 27 manual mode Enter the appropriate integer to select the version you want. In this case, I chose 1 and went with the emacs-snapshot version. Let us verify the work thus far. user@user-desktop:~$ update-alternatives --config emacs
There are 2 choices for the alternative emacs (providing /usr/bin/emacs).

Selection    Path                     Priority   Status
------------------------------------------------------------
0            /usr/bin/emacs-snapshot   27        auto mode
* 1            /usr/bin/emacs-snapshot   27        manual mode
2            /usr/bin/emacs24-x        27        manual mode

Lets check the version detected at the command line.

user@user-desktop:~\$ emacs -version
GNU Emacs 27.0.50
Copyright (C) 2019 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.

If all you care about is changing the Emacs version that runs in the terminal, then you are done at this point. However, if you would also like to change the GUI version, there are a couple more steps that need to be taken.

Unlock the existing Emacs GUI icon from the Launcher (Dock). Search for "Emacs" in the Launcher and launch the newly installed Emacs. In my case, the old version was called GNU Emacs 24 (GUI) and the new one was simply called Emacs. After launching, verify that it is the newer version