Oh my zsh and Oh My Posh on Termux
Overhaul the UI of the popular Android terminal emulator
Termux is a terminal emulator for Android, that with a little tweaking opens up a number of possiblities that would otherwise be difficult to acheive on your phone.
I personally use Termux daily to do the following
- Manage git repositories on my phone
- Connect to GitHub codespaces using the GitHub CLI and ssh
- Use emacs to edit files (which forms a powerful combination with git)
All of the tools to do the above (i.e. git
, gh
, emacs
) can be installed natively within termux using the termux package manager without installing a linux distro, which otherwise seems to be the most popular use of termux.
Those familiar with working in a terminal might be looking for some power-ups to make life within the terminal easier, and easier on the eye. Enter oh-my-szh and Oh My Posh
Installing oh my szh
Oh my zsh can be installed directly into termux, but to make life a little easier we're going to be using an install script found on GitHuib
To install, simply open up termux and run:
sh -c "$(curl -fsSL https://github.com/Cabbagec/termux-ohmyzsh/raw/master/install.sh)"
This will prompt you to select a font and theme on first run, but this can be skipped and run later using chfont
and chcolor
respectively, which are aliases that the script applies to your .zshrc
file.
After running the above, you should exit
and re-run termux to get things applied properly.
Installing Oh My Posh
Installing Oh My Posh is a little trickier, but well worth it.
The standard installers won't work for Termux. You'll need to download the binaries directly from the projects GitHub releases.
We are going to be using the posh-linux-arm64
binary. Note that v14.10.0 seems to be the last release that works with Termux. Any later versions (including the most recent at the time of writing) will not work.
Download the binary ``
First we are going to jump into the Termux bin directory
cd /data/data/com.termux/files/usr/bin
You'll need wget
to run the next line
pkg install wget
Next, we'll download the binary, renaming it to oh-my-posh
as we go
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v14.10.0/posh-linux-arm64 -O oh-my-posh
Finally, we need to give the binary permission to execute
chmod +x oh-my-posh
Running up Oh My Posh
Oh My Posh can be configured with themes, which we won't go into here. For now, we are going to get it running.
eval "$(./oh-my-posh init zsh)"
If all goes well, you should see the magic right away
Now, in order to get it running every time we open Termux, we want to add the above line to our .zshrc
file
With the emacs
plugin for oh my zsh, this is as simple as the following