Programming on an Android phone

A couple months ago I discovered an android terminal emulator named Termux by developer Fredrik Fornwall. I was surprised to learn that it ran a full linux environment on my phone.

The selling point for me in Termux’s play store description was the bullet “Develop in C with clang, make and gdb.” I don’t have much interest in programming with C, but this is the kind of claim that really made me wonder what I’d be able to do.

When you open Termux your default prompt is the pleasingly simple:

$ █

This is certainly a helpful touch considering that the terminal is only about 45 characters wide by default. Installing packages is as simple as you would expect with the built in pkg tool, a wrapper around the APT package manager.

My favorite thing to run with Termux is Emacs — a surprisingly semi-ok experience once you get familiar with the controls.

Emacs on a phone

Once you fire it up you can emulate a control key press with the volume down button + a letter. The arrow keys can be triggered with volume up + W/A/S/D. Scrolling the files with your finger even works! The shortcuts are clearly made by someone who planned on using them.

The limited horizontal space is a fun exercise in concise programming and makes you consider all the possible ways to cut down on on line length. As someone who prefers full words to acronyms it can get tricky, but the constraint can also help you write simpler code.

It was really something the first time I ran “python -m http.server” and it actually started a web server that could be accessed through my phone’s browser. You can also connect to your phone’s web server from your laptop over wifi.

A quick canvas demo written and running on my phone

There’s something interesting about running a terminal in a non-windowed operating system. It makes me question whether laptops and desktops are really the only viable machines for developers to use. Don’t get me wrong, I think windows are a great way of organizing a bunch of running programs. But there’s a reason phones don’t have them; they’re more efficient to use when you don’t have to worry about the “sizes” of apps.

I’m not about to pack up my laptop and use my phone for work, but this app has convinced me that android has the potential to be a good development platform. I just don’t think it’s been fully explored.