Termux SSH : Use Termux in Mac Using SSH Server 🍎📱

In my previous post, I showed you how to use Termux in Windows using SSH Server. A lot of you guys asked me if the same thing is possible on a Mac, and the answer is YES! In this post, I am going to show you how you can use your Android's Termux directly from your Mac Terminal using SSH.

We are not going to install Termux on macOS because that's not possible. Instead, we will remotely access the original Termux running on our Android phone. This tutorial contains all the commands you need to configure the SSH server and connect it from your Mac. Since macOS already comes with an SSH client, the setup is actually easier than Windows. This is going to be a detailed Termux SSH tutorial for Mac users. 📱💻

What is SSH Server in Termux?

SSH stands for Secure Shell. It is a secure network protocol that allows two computers to communicate with each other over an encrypted connection. Nobody can see what's happening between your devices because everything is encrypted.

With the help of SSH, we can turn our Android phone into a small Linux server and access it directly from our Mac. Once the connection is established, you'll be able to use your original Termux from the Mac Terminal without touching your phone again.

Termux SSH : Use Termux in Mac

Termux is completely command-line based, so while using it from your Mac, it feels almost like it is installed natively on macOS. You can install packages, clone GitHub repositories, edit files, run Python scripts, use Git, and do everything you normally do inside Termux.

I personally use this method whenever I need a bigger screen or a proper keyboard. It feels much faster than typing everything on a phone.


Use Termux in Mac using SSH Server

Please read this article carefully because this one is not just copy and paste. Every step depends on the previous one, so if you skip something, it probably won't work.

Step 1: Install SSH in Termux

First of all, we need to install OpenSSH and Nmap inside Termux. OpenSSH will create our SSH server while Nmap will help us find our local IP address and the SSH port.

Just type the below command.

pkg update && pkg upgrade
pkg install openssh nmap -y

Output

Hit:1 https://packages.termux.dev/apt/termux-main stable InRelease Reading package lists... Done Building dependency tree... Done Reading state information... Done openssh is already the newest version. nmap is already the newest version. 0 upgraded, 0 newly installed, 0 to remove.

Step 2: Run SSH Server in Termux

Now we have to start the SSH Server.

Simply type the below command.

sshd

Output

$

If you don't see anything, don't worry. That means the SSH server started successfully.


Step 3: Get Your User ID

Now the SSH Server is running.

Before connecting from the Mac, we need our username.

Type the below command.

whoami

Output

u0_a245

Make sure you copy the complete username because we'll use it later.


Step 4: Configure Termux Password

Now we have to create a password for our Termux user.

Replace the username below with your own username.

passwd u0_a245

Output

New password: Retype new password: passwd: password updated successfully

Don't worry if nothing appears while typing your password. It is hidden for security reasons.


Step 5: Find Local IP & SSH Port

Now we need two things before connecting.

  • 📍 Our Local IP Address
  • 🔐 SSH Port

Since we already installed Nmap, it will show us both in a single command.

Just type:

nmap localhost

Output

Starting Nmap 7.95 ( https://nmap.org ) at 2026-07-03 14:28 IST Nmap scan report for 192.168.1.105 Host is up (0.00014s latency). Not shown: 999 closed tcp ports (reset) PORT STATE SERVICE 8022/tcp open ssh Nmap done: 1 IP address (1 host up) scanned in 0.18 seconds

As you can see above, Nmap gives us everything we need.

Our IP Address is

192.168.1.105

And our SSH Port is

8022

Copy both because we'll need them in the next step.


Step 6: Connect Termux from Mac

This is the main step.

Open the Terminal application on your Mac.

Now type the below command.

ssh username@your-ip-address -p portnumber

Example

ssh u0_a245@192.168.1.105 -p 8022

Replace the username, IP address and port with your own values and press Enter.

Output

The authenticity of host '[192.168.1.105]:8022 ([192.168.1.105]:8022)' can't be established. ED25519 key fingerprint is SHA256:QxYdQ2Qb2M5Q7rL5Qh3x3wExampleFingerprint. This key is not known by any other names. Are you sure you want to continue connecting (yes/no/[fingerprint])?

Simply type

yes

and press Enter.


Step 7: Enter Password

Now it will ask for the password that we created in Step 4.

u0_a245@192.168.1.105's password:

Type your password and press Enter.

Output

Welcome to Termux! ~ $

Congratulations! 🎉

You are now inside your Android's original Termux directly from your Mac.

Anything you install, edit, create or delete from your Mac will happen inside your Android phone because this is your real Termux environment.


How to Resolve "sshd: no hostkeys available -- exiting"

Sometimes after reinstalling Termux or clearing its data, you might see this error.

sshd: no hostkeys available -- exiting

Don't worry, this is very easy to fix.

Simply type:

ssh-keygen -A

Wait for a second and then start the SSH Server again.

sshd

Now everything should work normally.


How to Close the SSH Server?

If you want to stop the SSH Server without closing Termux, simply type:

pkill ssh

The SSH Server will stop immediately.


How to Connect Again?

The best part about this method is that you only have to configure it once.

Next time, simply run:

sshd

Then check your IP Address and SSH Port again.

nmap localhost

Finally connect from your Mac using:

ssh username@your-ip-address -p portnumber

That's it.


Conclusion

SSH is the easiest way to use Termux from a Mac. Since macOS already includes an SSH client, there is no need to install any additional software. After a one time setup, connecting to your Android takes only a few seconds. I hope this tutorial made everything simple. If you're still facing any issues while connecting your Mac to Termux, let me know in the comments below and I'll try my best to help you out. I might even create a one click setup script in the future to make the whole process even easier. Thanks for reading guys. Stay Inspired and as always, Stay Ethical. 👾

Post a Comment

0 Comments

⚡ Get Complete Termux Course