No PC? No problem! Learn how to install and configure Emacs in Termux to take full control of your coding environment, right from your Android.
When I first dove into the world of Android development, I quickly realized how limiting the standard tools on mobile devices could be. I wanted more—something that would give me the flexibility of a full development environment, without needing to lug around a laptop. That’s when I stumbled upon Termux, a powerful terminal emulator that transforms your Android phone into a development powerhouse.
But the real game-changer for me was Emacs in Termux. If you’re a developer who loves Emacs’ versatility, you might know how crucial it is to get it working smoothly in your environment. Installing and configuring it on Termux isn’t as simple as hitting “install,” but once it’s up and running, it’s like unlocking a whole new level of productivity on your mobile device.
In this guide, I’ll show you exactly how to install and configure Emacs in Termux, so you can take your coding on the go. Ready to supercharge your Android setup? Let’s get started.
Download my FREE Termux Cheat Sheet Now!
Why Emacs in Termux is a Game-Changer
For many developers, Emacs is more than just a text editor—it’s an entire work environment. Running Emacs in Termux brings the power of this legendary editor straight into your pocket. Whether you’re editing code, writing documents, managing projects, or even emailing from the command line, Emacs turns your Android device into a serious mobile workstation.
Even better? It’s fully FOSS, aligning perfectly with the open-source spirit of Termux users. In a world increasingly reliant on bloated proprietary apps, wielding Emacs on your phone feels almost rebellious—in the best way.
· · ─ ·𖥸· ─ · ·
Getting Emacs Up and Running in Termux
To start using Emacs in Termux, the first step is to ensure you have a clean installation of Termux with the necessary packages. You’ll need to install Emacs using Termux’s built-in package manager. Begin by updating your package lists with the command pkg update
and then install Emacs by running pkg install emacs
. This simple installation process will get Emacs ready to use, but for a seamless experience, there are additional configurations and customizations to explore. Whether you’re using Emacs for coding, writing, or note-taking, the powerful features of this editor can make your mobile development workflow just as efficient as on a desktop system.
Before we begin, ensure you have Termux installed on your Android device. You can download it from the Google Play Store or F-Droid.
Let’s dive into how you can get everything set up for optimal performance in Termux.
Step 1: Update Termux Packages
It’s always a good practice to update your package list and upgrade existing packages before installing new software. Open Termux and enter the following commands:
pkg update && pkg upgrade
This command will ensure that all your packages are up to date, minimizing potential issues during installation.
Step 2: Install Emacs in Termux
With your packages updated, you can now install Emacs in Termux. Run the following command:
pkg install emacs
The installation will take a few minutes, depending on your internet speed.
Step 3: Launch Emacs
Once the installation is complete, you can start Emacs by simply typing:
emacs
Emacs will launch in your Termux terminal. If you’re new to Emacs, you might find the interface a bit overwhelming at first, but don’t worry—we’ll guide you through some basic configurations.
Step 4: Basic Emacs Configuration
Emacs is highly customizable, and you can start by creating a basic configuration file. This file is called .emacs
and is located in your home directory. Here’s how you can create it:
Open the configuration file:
~/.emacs
Add some basic configurations:You can add the following lines to customize your Emacs experience:
;; Disable the startup message
(setq inhibit-startup-message t)
;; Enable line numbers globally
(global-linum-mode t)
;; Set the default font size
(set-face-attribute 'default nil :height 120)
;; Enable syntax highlighting
(global-font-lock-mode t)
;; Set a custom theme
(load-theme 'wombat t)
Save the file and exit:Press Ctrl-x
followed by Ctrl-s
to save, and Ctrl-x
followed by Ctrl-c
to exit.
Step 5: Additional Configuration (Optional)
Emacs supports a vast array of plugins and extensions. You can install packages like magit
for Git integration, company
for autocompletion, or even org-mode
for managing your tasks and notes.
Install the package manager: Add the following to your .emacs
file to install and use the Emacs package manager (MELPA):
;; Initialize package sources
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
;; Initialize the package system
(package-initialize)
;; Refresh package contents
(unless package-archive-contents
(package-refresh-contents))
;; Install use-package for easy package management
(unless (package-installed-p 'use-package)
(package-install 'use-package))
;; Ensure use-package is always used
(eval-when-compile
(require 'use-package))
Installing packages:You can now install packages with use-package
. For example, to install magit
:
(use-package magit
:ensure t)
Save and restart Emacs to activate the package.
Step 6: Mastering Emacs
Emacs has a steep learning curve, but once you get the hang of it, it becomes a powerful tool in your arsenal. Here are a few tips to get started:
- Learn the keybindings: Emacs is keyboard-centric. Learning keybindings like
Ctrl-x Ctrl-f
(open file) andCtrl-x Ctrl-s
(save file) will speed up your workflow. - Use the built-in tutorial: Type
Ctrl-h t
to access the Emacs tutorial. - Explore packages: The Emacs community has developed thousands of packages. Explore them to extend Emacs’ functionality.
· · ─ ·𖥸· ─ · ·
Use Case and Target Audience
This guide on installing and configuring Emacs in Termux is particularly beneficial for students, developers, and tech enthusiasts who rely on mobile devices for coding and writing. Students who can’t afford laptops can use this setup to turn their Android devices into powerful programming environments, making it accessible and cost-effective to continue learning and developing on the go.
· · ─ ·𖥸· ─ · ·
Bonus Tip: Speed Up Emacs Performance in Termux
Phones have less RAM and CPU power than laptops or desktops, so it’s smart to optimize Emacs for speed.
Here are a few quick wins:
- Avoid loading heavy themes and graphics-heavy packages.
- Use minimalistic modes like
doom-modeline
ornano-emacs
. - Compile your
.el
files into.elc
bytecode for faster loading. - Disable unnecessary auto-save features that can slow down smaller devices.
These simple optimizations can make the difference between a sluggish experience and a smooth, desktop-like performance—even inside a Termux shell.
· · ─ ·𖥸· ─ · ·
Embrace the Power of Emacs in Termux for Mobile Development
By installing Emacs in Termux, you bring the power of one of the most customizable and powerful text editors to your Android device. Whether you’re editing code on the go or configuring your personal development environment, Termux provides you the flexibility to do it all.
Emacs, when paired with Termux, becomes more than just an editor—it becomes your mobile coding studio. If you’ve followed the steps here, you now have a robust setup that can serve as your portable workstation anytime, anywhere.
For more FOSS-friendly guides like this one, be sure to subscribe to my newsletter at DevDigest, where I share the latest tips, tricks, and tutorials to help you get the most out of your open-source tools.
Leave a Reply