Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Install Git, Python & Node.js in Termux

· 4 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Termux turns your Android phone into a mini Linux environment, letting you run real development tools right from the terminal. This guide walks you through installing Git, Python, and Node.js, then shows you how to use them for everyday coding tasks like cloning repositories, running scripts, and managing packages.

What You'll Need

  • An Android device (7.0 or newer recommended) with at least 2GB of free storage.
  • The Termux app installed from F-Droid (the Google Play version is outdated and no longer maintained).
  • A stable internet connection for downloading packages.

Step-by-Step

  1. Update Termux and its repositories. Open Termux and run:
    pkg update && pkg upgrade -y
    This refreshes the package list and upgrades existing packages. It may take a few minutes.
  2. Install Git. Run:
    pkg install git -y
    Git is used for version control and cloning repositories.
  3. Install Python. Run:
    pkg install python -y
    This installs Python 3 and pip (the package manager). Verify with python --version.
  4. Install Node.js. Run:
    pkg install nodejs -y
    This installs Node.js and npm. Check with node -v and npm -v.
  5. Set up Git identity (optional but recommended). Run:
    git config --global user.name "Your Name"
    git config --global user.email "you@example.com"
    This is needed for committing changes.
  6. Clone a repository to test Git. For example:
    git clone https://github.com/octocat/Hello-World.git
    Then cd Hello-World to enter the folder.
  7. Run a Python script. Create a file with nano test.py, type print("Hello from Python"), save with Ctrl+X, Y, Enter, then run python test.py.
  8. Run a Node.js script. Create test.js with console.log("Hello from Node"); and run node test.js.
  9. Install a Python package (example: requests). Run:
    pip install requests
    Use it in a script with import requests.
  10. Install an npm package (example: express). Run:
    npm install express
    This creates a node_modules folder in your current directory.

Common Mistakes

  • Skipping the update step. Installing packages without updating first often leads to dependency errors.
  • Using the Play Store version of Termux. It's abandoned and lacks the repositories needed for these tools.
  • Typing python3 instead of python. In Termux, both usually work, but python is the standard alias.
  • Not granting storage permissions. If you want to access files in shared storage, run termux-setup-storage and accept the permission prompt.
  • Running npm install without a package.json. It still works but creates a messy folder; use npm init -y first.

Tips

  • Use pkg search <package> to find available packages before installing.
  • Keep your system updated weekly with pkg upgrade to avoid security issues.
  • Install nano or vim for editing files inside Termux: pkg install nano -y.
  • For a better terminal experience, install zsh and oh-my-zsh after setting up the basics.
  • Use termux-wake-lock to prevent the CPU from sleeping during long downloads or builds.

Troubleshooting

  • "Unable to locate package" error. This usually means the repositories are outdated. Run pkg update again and ensure you have a stable internet connection.
  • Installation freezes or is very slow. Try switching to a different mirror: termux-change-repo and choose a mirror closer to you.
  • Python or Node commands not found after install. Restart Termux (swipe away the app and reopen) to refresh the PATH.
  • Git clone fails with SSL certificate error. Update CA certificates: pkg install ca-certificates -y.
  • npm permission errors. Avoid using sudo (not available by default). Instead, ensure you are in your home directory and not in a system folder.
  • Storage permission denied. Run termux-setup-storage again and make sure you tap "Allow" on the Android prompt.

Frequently Asked Questions

Can I install all three at once?

Yes, run pkg install git python nodejs -y in one line. It will install all three simultaneously.

Do I need root access?

No, Termux works entirely in user space. Root is not required for any of these tools.

How do I uninstall one of them?

Use pkg uninstall git (or python/nodejs). This removes the package and its dependencies.

Can I run a web server from Termux?

Yes, you can run Node.js or Python servers. For example, python -m http.server serves the current directory.

Will these tools work offline?

Once installed, Git, Python, and Node.js work offline for local tasks. However, installing packages or cloning repositories requires internet.

What is the difference between pip and npm?

pip is Python's package manager, while npm is Node.js's. They are not interchangeable.