How to Install Emacs on Raspberry Pi

I just got my Raspberry Pi up and running on Raspbian, and was finding nano, the pre-installed text editor a bit lacking.  I’ve been using Emacs since college, and decided to get it up and running on my Pi.  It turns out that it’s quite simple to install GNU Emacs:

$ sudo apt-get install emacs

If the above command fails and complains of missing packages, try

$ sudo apt-get upgrade

and then retry installing emacs (thanks to Tom Sargent for this tip).

Emacs users typically prefer their ctrl keys to reside where the Caps Lock key typically resides on most PC keyboards.  To swap the left Ctrl and Caps Lock keys, edit /etc/default/keyboard, and find the line XKBOPTIONS line.  If it’s currently empty, just replace it with


if the line already has some other options in it, simply separate the options with a comma, e.g.:


To make the change effective, type:

$ sudo dpkg-reconfigure -phigh console-setup

They keyswap will persist across reboots, and works in both virtual text consoles, and X-windows.

5 thoughts on “How to Install Emacs on Raspberry Pi”

  1. I couldn’t get “apt-get install emacs” to work – it complained about missing packages. I finally got it to work by doing an apt-get upgrade first. No source that I could find mentioned doing this. It’s not unreasonable. Did you have to do an upgrade too, or did I miss something else. (I didn’t see the start-up instructions for the Pi mentioning doing an upgrade.)

    1. I don’t recall having to do an upgrade first, but it’s been a while, and I might have done it, and forgotten about it. I will update the instructions. Thank you.

  2. Try tramp-mode to use a remote emacs to access your RPi:

    C-x C-f / …..

    but it’s nicer with ssh-agent, etc.,

    Then you can use your normal desktop/laptop emacs setup to work on remote file.

  3. First Must Do!

    $ sudo apt-get update
    $ sudo apt-get upgrade
    $ sudo apt-get install emacs

    Once installed start in Terminal window.

Leave a Reply