Use Termux and Homebrew on Android without root

Posted: 4/15/2026 | Updated: April 15, 2026

This guide covers the 2026 Google Play version of Termux and includes the necessary workarounds for Homebrew's no-root policy.

Step 1: Initialize Termux

Install Termux from the Google Play Store (v2026.x.x). Once opened, run:

pkg update && pkg upgrade -y
termux-setup-storage

Accept the storage prompt on your Android screen.

I always do this first and then wait for the storage permission prompt before moving on. It saves a few minutes of debugging later.

Step 2: Native Ruby (Optional/Fastest)

If you don't strictly need Homebrew, install Ruby natively. It is much faster and uses fewer resources than a Linuxbrew install inside a container.

pkg install ruby -y
ruby -v

I usually try this path first. On my test phone it took under a minute, and I only switch to the Homebrew route when I need a package that requires a more standard Linux environment.

Step 3: Set Up the Homebrew Environment

Homebrew requires a standard Linux filesystem and a non-root user. We will use an Ubuntu container via proot-distro.

1. Install & enter Ubuntu

pkg install proot-distro -y
proot-distro install ubuntu
proot-distro login ubuntu

2. Create a non-root user

Inside the Ubuntu prompt (root@localhost):

apt update && apt upgrade -y
apt install sudo curl git build-essential procps file -y

# Create user 'brewuser', set a password, and give sudo rights
useradd -m -s /bin/bash brewuser
passwd brewuser
usermod -aG sudo brewuser

# Switch to the new user
su - brewuser

You can name the user anything, but I stick with brewuser because it makes the later commands easy to remember.

Step 4: Install Homebrew

Now that you are logged in as brewuser, run the official installer:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Add Homebrew to your PATH

After the install finishes, copy and paste these three lines to make the brew command work:

echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.bashrc
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

One small quirk: if you forget the eval line, brew will install, but the command won’t be available until you start a new shell.

Step 5: Install Ruby via Homebrew

With Homebrew active, you can now install Ruby or any other formula:

brew install ruby
ruby -v

This is the path I recommend when you want a closer approximation of a normal Linux dev environment on Android.

Quick reference: returning to Homebrew

When you close Termux and want to get back into your Homebrew environment later, run this one-liner:

proot-distro login ubuntu --user brewuser

That command is the one I paste into every new shell session. It is the fastest way back into the Homebrew container without needing to remember the full Ubuntu login sequence.

See also

Frequently asked questions

No. Termux ships a native Ruby package, and that is usually the fastest option. Homebrew is only worth it if you want a more standard Linux package environment.