20

I love using Emacs and I want to have the latest version of Emacs always. But on my Ubuntu machine Emacs won't be upgraded automatically during the regular software updates. Even when I run sudo apt-get upgrade emacs it says I have the latest Emacs while I don't. I see I am using 24.4 version of Emacs while the latest one is 24.5.

I have searched for ways to upgrade Emacs to the latest version but I couldn't find any. Can you please tell me how to do that?

2
  • 6
    Is this a question about emacs or about Ubuntu's repositories?
    – Dan
    Sep 27, 2015 at 18:37
  • It's about emacs.
    – samsri
    Sep 28, 2015 at 8:08

8 Answers 8

5

Follow these directions for Ubuntu substituting 24.5 in the download step 5 and subsequent steps.

8
  • Do we need to go through the whole process for every version? Isn't there a simpler way. For example we can upgrade eclipse by choosing upgrade eclipse from help menu
    – samsri
    Sep 26, 2015 at 4:56
  • Only for times when ubuntu repositories are not updated to the latest. There is usually a lag between official releases and when downstream repositories like ubuntu have them ready for apt-get automatic updates.
    – Emacs User
    Sep 26, 2015 at 4:59
  • 2
    @EmacsUser this answer would be better if it contained not just the link but the actual instructions.
    – user2005
    Sep 27, 2015 at 7:08
  • 2
    @rekado, I don't have permission to copy from ubuntu website. If you do, feel free to update my answer.
    – Emacs User
    Sep 28, 2015 at 0:49
  • 2
    @EmacsUser: that summary is probably not detailed enough for someone to use this answer/comment combo on its own. I'm asking for more information for the benefit of future readers; the OP appears to be inexperienced with SE and so may have accepted the answer too quickly.
    – Dan
    Sep 29, 2015 at 13:48
14

With GNU Guix you can easily reuse the package definition for Emacs with a later tarball.

guix build emacs --with-source=http://some/emacs/tarball.tar.xz

Emacs 27.2 is available via Guix, so you'd just need to run guix install emacs to install the latest stable version.

You can install emacs 28.0 with guix install emacs-next.

Even if Guix did not offer the latest version you cloud easily create a package variant, such as this:

(define-public my/emacs
  (package (inherit emacs)
    (name "custom-emacs")
    (version "25.7")
    (source (origin
              (method url-fetch)
              (uri (string-append "mirror://gnu/emacs/emacs-"
                                  version ".tar.xz"))
              (sha256
               (base32
                "0kn3rzm91qiswi0cql89kbv6mqn27rwsyjfb8xmwy9m5s8fxfiyx"))))))

You can use Guix as a package manager on top of Ubuntu or any other GNU system.

2
  • Great, I read about guix before and now I tried it as I came across your post and everything just worked :) Do you have some links/resources how to get started with guix and how to build packages for it and contribute them to the repositories?
    – clemera
    Sep 26, 2015 at 22:41
  • Great! You should clone the git repository and add package definitions in the module files in gnu/packages. See the section on contributing in the manual. If you need help you can ask on the #guix IRC channel on freenode.
    – user2005
    Sep 27, 2015 at 7:07
6

Compiling from source is an option, of course (which may or may not be obvious to you).

If you're willing to invest in learning how to do that, you'll be able to compile and use virtually any version of Emacs you're interested in (whether that's the latest stable release; one of the "pretest" builds for the next release; or the latest code from the source repository).

4

For Ubuntu distributions, you can install the ubuntu-elisp PPA. Currently it contains Emacs 25.0.50.2, from 2015-09-19. This is not the latest stable version, but I've found it to work well enough. To install:

$ sudo apt-add-repository ppa:ubuntu-elisp/ppa
$ sudo apt-get update
$ sudo apt-get install emacs-snapshot

Then run Emacs as emacs-snapshot instead of emacs. This way you can have both bleeding-edge and stable version simultaneously.

New updates will be pulled down through Ubuntu's normal update process.

2
  • I'd not recommend this PPA. It builds only infrequently, particularly for older Ubuntu releases. Look at the date of the last build for the current LTS version.
    – user227
    Sep 28, 2015 at 12:46
  • It is rather far behind for LTS, but it updates frequently for the latest Ubuntu.
    – erikstokes
    Sep 28, 2015 at 20:11
2

I use gsrc for this. Just follow the instructions on the website - and be sure to read the manual. Basically, when you have a running gsrc you can type

make -C gnu/emacs

and the latest stable version of emacs will be downloaded and compiled for you, including some of the dependencies.

I don't like the default configuration parameters that are used in gsrc, therfore I alter the config.mk file accordingly in the gnu/emacs directory. Note, that if you want some third-party non-gnu dependencies (i.e. for image support in emacs), these libraries need to be present on your system.

0

Christian Herenz answer mentions that using gsrc is a good way to stay updated. In the past I have used gsrc although it has been a bit difficult to use sometimes. It seems they have introduced a command-line application for making it easier to use without running make commands. The documentation also is possibly out of date since the old make -C gnu/application command would not work at all for me.

However, if you use the new gsrc executable in the main gsrc directory you can easily install and update packages, e.g.:

gsrc install emacs
gsrc update emacs

gsrc is automatically installed when you first install or reinstall gsrc (I just reinstalled the whole thing).

0

Install Emacs with flatpak (you need to have flatpak installed) or with snap (snap is installed by default on ubuntu distributions).

To keep Emacs updated, do

  • $ flatpak update if you use flatpak,
  • $ sudo snap refresh if you use snap.
-2

Upgrading to the latest Emacs asap is NOT always a good idea.

For example, Emacs 24.4 has a bug that will make M-x fail if evil-mode is used (https://bitbucket.org/lyro/evil/issues/437/m-x-is-undefined-in-emacs-244).

In my experience, it's better to wait 6 months to give third party plugins some buffer time to fix the compatibility issue.

But, if you don't care about the above issue. Here are the easiest way to install from source code.

Install Emacs into your HOME directory:

mkdir -p ~/myemacs24.5; ./configure --prefix=~/myemacs/24.5 --without-gtk --without-gtk3 --without-aqua --without-x --without-xpm --without-png --without-gif --without-alsa --without-tiff --without-jpeg --without-aqua --without-rsvg --without-xft --without-xaw3d --without-xim --without-xpm --without-dbus --without-makeinfo --with-x-toolkit=no --without-sound --without-sync-input --without-pop;make;make install

Install Emacs into default directory:

./configure --without-gtk --without-gtk3 --without-aqua --without-x --without-xpm --without-png --without-gif --without-alsa --without-tiff --without-jpeg --without-aqua --without-rsvg --without-xft --without-xaw3d --without-xim --without-xpm --without-dbus --without-makeinfo --with-x-toolkit=no --without-sound --without-sync-input --without-pop;make;sudo make install

I'm 100% sure my way will always work because I've been using this way on Ubuntu/Mint/Debian/Centos/Gentoo/ArchLinux for 4 years without any issue.

1
  • 7
    For the benefit of people new to the process of compiling Emacs, take note that the above approach produces an executable with no graphics, sound, or GUI support.
    – phils
    Oct 2, 2015 at 1:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.