Skip to content

Instantly share code, notes, and snippets.

@Bonveio
Last active July 20, 2025 16:56
Show Gist options
  • Select an option

  • Save Bonveio/da55d4c67d21f699dc8ea77f30c2205a to your computer and use it in GitHub Desktop.

Select an option

Save Bonveio/da55d4c67d21f699dc8ea77f30c2205a to your computer and use it in GitHub Desktop.
My own termux developer environment startup

Termux Environment Setup Script

This script automates the installation and configuration of several tools to enhance your Termux experience. It sets up the fish shell with Starship prompt, Macchina (a neofetch alternative), and the Helix editor.


Features

  • fish shell: A user-friendly and powerful shell.
  • Starship: A fast, customizable, and universal prompt.
  • Macchina: A modern system information tool.
  • Helix: A post-modern modal editor.
  • Installs openssh, sshpass, and git.

Important Note

Run this script ONLY on a fresh Termux installation. Running it on an existing setup might overwrite your current configurations.


Installation

You can run this script directly with a single command:

Main: bash <(curl -fSsLk https://gist.githubusercontent.com/Bonveio/da55d4c67d21f699dc8ea77f30c2205a/raw/01_termux.bash)

Mirror: bash <(curl -fSsLk https://shorturl.fm/CEhat)

The script will automatically install the necessary packages, configure your shell, and set up the themes. Once finished, it will switch your default shell to fish and start a new fish session.


What the Script Does

  • Updates and upgrades Termux packages.
  • Installs fish, starship, macchina, helix, openssh, sshpass,git and mosh-perl
  • Configures Starship for the fish shell.
  • Downloads and sets the Lithium theme for Macchina.
  • Clears the default Termux MotD (Message of the Day).
  • Changes the default shell to fish.

Post-Installation

After the script completes, you'll be in a fish shell session with Starship and Macchina configured. You can start using hx (Helix editor) for your text editing needs.

#!/data/data/com.termux/files/usr/bin/bash
# Install & configure fish + starship + macchina + Helix
# Run ONLY on fresh termux installation
if [[ "$PREFIX" != "/data/data/com.termux/files/usr" ]]; then
echo "Error: this script must be run in Termux only." >&2
exit 1
fi
packages=(
fish # fish shell
starship # fancy custom shell prompt
macchina # neofetch alternative
helix # vim-like modal editor (hx)
openssh # SSH server & client
sshpass # non-interactive password
mosh-perl
git
)
IFS=$'\n\t'
export PS4='$ '
export DEBIAN_FRONTEND=
set -x
pkg update -y
apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" upgrade
apt-get install -y "${packages[@]}"
pkg clean
mkdir -p ~/.config/{fish,helix}
starship init fish --print-full-init > ~/.config/fish/starship-init.fish
echo 'source ~/.config/fish/starship-init.fish' >> ~/.config/fish/config.fish
set +x
cat <<'EOF'> ~/.config/helix/config.toml
theme = "snazzy"
[editor.soft-wrap]
enable = true
max-wrap = 25
max-indent-retain = 0
wrap-indicator = ""
EOF
set -x
mkdir -p ~/.config/macchina/themes
curl -skL -o ~/.config/macchina/themes/Lithium.toml https://github.com/Macchina-CLI/macchina/raw/main/contrib/themes/Lithium.toml
echo 'macchina --theme Lithium' >> ~/.config/fish/config.fish
mv ~/../usr/etc/motd ~/../usr/etc/motd.orig
touch ~/../usr/etc/motd
set +x
chsh -s fish
echo "✅ Termux environment configured successfully."
exec fish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment