# Turning My Spare Phone Into a 5G Modem for My Mac

> macOS can't use my Android phone's USB tethering, and the phone won't switch to a mode macOS supports. So I run a proxy on the phone through adb and route the whole Mac through it, with no app, no root and no kernel extension.

I have a spare Android phone that gets good 5G. My Mac has no SIM. The obvious bridge is a Wi-Fi hotspot, but a hotspot drains the phone, drops when the phone sleeps, and needs reconnecting every time. A cable should be better: faster, steadier, and it charges the phone at the same time.

So I plugged the phone, a Realme, into my Mac, turned on USB tethering, and opened System Settings → Network. Nothing new appeared.

The cable was fine. The Mac could see the phone as a USB device, and so could System Information. The two machines were connected but couldn't agree on a way to send network traffic to each other.

By the end of the night I had a small Go service that notices the phone being plugged in, starts a proxy on the phone over adb, and routes all of the Mac's traffic through it. It needs no phone app, no root and no kernel extension. This post covers how I got there, including the dead ends. The code is at [peritissimus/usb-tether](https://github.com/peritissimus/usb-tether).

## Two protocols, zero overlap

When an Android phone tethers over USB, it pretends to be a USB network adapter. There are two common ways to do that:

- **RNDIS**, a Microsoft protocol. Windows supports it out of the box, and most Android vendors default to it.
- **NCM**, a USB standard. macOS supports it out of the box.

macOS has no RNDIS driver. The old fix was [HoRNDIS](https://github.com/jwise/HoRNDIS), a third-party kernel extension. On Apple Silicon, getting a third-party kernel extension to load means lowering the Mac's security settings in Recovery mode, and HoRNDIS hasn't kept up with recent macOS releases anyway.

I confirmed which mode the phone was in by looking at the interfaces it exposed:

```text
RMX3241
├── RNDIS Communications Control   (class 224)
└── RNDIS Ethernet Data            (class 10)
```

That's RNDIS only.

## Asking the phone nicely to switch to NCM

Android 11 added a global setting that tells the tethering service to use NCM instead of RNDIS:

```bash
adb shell settings put global tether_force_usb_functions 1
```

On my phone, that failed with a `SecurityException`. Realme, OPPO and OnePlus phones block adb from writing system settings unless you turn on **Disable permission monitoring** in Developer options and restart. After that the write went through, and reading it back returned `1`.

Then I turned USB tethering back on, and the phone used RNDIS again. Forcing the USB function directly with `svc usb setFunctions ncm` was also ignored. The setting existed and was saved, but the vendor firmware simply didn't act on it.

That left the usual fallbacks: a Wi-Fi hotspot, Bluetooth tethering, or EasyTether, a paid app that needs its own driver on the Mac. I wanted something wired, hands-free and free, so I looked at what I already had working: adb.

## The adb shell can reach the internet

While poking around, I noticed something useful. Processes started from `adb shell` run as the `shell` user, and on Android that user is allowed to use the network:

```bash
adb shell ping -c1 1.1.1.1
# 1 packets transmitted, 1 received, 0% packet loss
```

So I didn't need the phone to act as a network adapter at all. I could run an ordinary proxy server on the phone, reach it over the USB cable through adb, and point the Mac at it. EasyTether works on the same basic idea.

```text
Mac apps
  └─> utun99 (sing-box TUN, Mac)
        └─> SOCKS5 over `adb forward tcp:1080`
              └─> sing-box proxy on the phone (/data/local/tmp, via adb shell)
                    └─> mobile data
```

I used [sing-box](https://github.com/SagerNet/sing-box) at both ends. It's a mature open-source proxy written in Go, and it publishes builds for both Android and macOS.

## The phone side: a proxy that needs no app

The phone side is one binary pushed to `/data/local/tmp`, a directory the shell user can write to and run programs from, plus a tiny config:

```json
{
  "inbounds": [{ "type": "mixed", "listen": "127.0.0.1", "listen_port": 1080 }],
  "outbounds": [{ "type": "direct" }]
}
```

It listens only on the phone's own loopback address. `adb forward tcp:1080 tcp:1080` makes it appear at `127.0.0.1:1080` on the Mac, carried over the USB cable. A quick `curl --socks5-hostname` through it came back with a different public IP than my Wi-Fi did, which proved the traffic was leaving through the phone's mobile data.

## The Mac side: making every app use it

A SOCKS proxy only helps the apps that know to use one. To send everything through it, the Mac runs a second sing-box in TUN mode. It creates a virtual network interface (`utun99`), adds routes that send all traffic into it, and passes each connection to the SOCKS proxy on the phone.

Three details made it behave like a real network connection:

- **DNS goes through the phone.** sing-box intercepts DNS queries and resolves them over TCP, through the phone, so name lookups never depend on Wi-Fi.
- **UDP rides inside TCP.** `adb forward` only carries TCP, so UDP traffic is wrapped inside the TCP connection. It works, but it's less efficient than real UDP.
- **Local addresses stay local.** Private address ranges skip the tunnel, so the router admin page and other local devices still work.

## Turning off Wi-Fi broke DNS

With Wi-Fi still on, everything worked. With Wi-Fi off, every website failed, and none of the failed requests even showed up in the tunnel's log.

Requesting a site by its IP address still worked. Requesting it by name didn't. The tunnel was fine; macOS had nowhere to send DNS queries. `scutil --dns` listed no resolvers at all. Wi-Fi had been the only *network service*, the thing macOS uses to decide which DNS servers to use and whether it is online at all.

VPN clients solve this by registering their tunnel with SystemConfiguration, the part of macOS that keeps track of network services. So I did the same:

```text
d.init
d.add Addresses * 172.19.0.1
d.add Router 172.19.0.1
d.add InterfaceName utun99
set State:/Network/Service/usbtether/IPv4
d.init
d.add ServerAddresses * 172.19.0.2
d.add SupplementalMatchDomains * ""
set State:/Network/Service/usbtether/DNS
```

After that, `scutil --nwi` listed `utun99` as the primary interface, DNS worked, and the Mac stayed online with Wi-Fi switched off. The DNS address doesn't need anything listening on it. It only has to be routed into the tunnel, where sing-box recognises DNS traffic and answers it.

## From a script to "plug it in and forget it"

At this point it worked, but only if I ran a script and typed my password every time. My first shell version also had a bug that was a good argument for leaving shell behind. Its "stop the old proxy" step ran `pkill -f 'sing-box run'`, and the command line of the shell running that `pkill` contained the same text, so it killed itself and exited with code 143.

So I rewrote it as a small Go program with three modes:

| Command | Runs as | Job |
|---|---|---|
| `usbtether daemon` | root, via launchd | Watches for the phone, starts and stops everything |
| `usbtether menubar` | user, via launchd | Menu bar status, speed, Pause and Reconnect |
| `usbtether install` | sudo, once | Copies binaries, registers both services |

The daemon checks adb once a second. When a phone shows up, it:

1. Pushes the sing-box binary to the phone if it's missing or a different size.
2. Writes the phone config and starts the proxy in an `adb shell` session it keeps open.
3. Sets up `adb forward` and waits until the proxy answers.
4. Starts the Mac's TUN, waits for `utun99` to appear, and registers the network service.

When the phone disappears or the proxy stops, it undoes all of that in reverse order, and the Mac goes back to normal networking.

A few decisions mattered more than the rest:

- **adb runs as me, not as root.** The daemon needs root to create the TUN interface. If it ran adb as root, adb would use a different key and the phone would ask for authorisation again, and root would leave its own files in my `~/.android` folder. So the daemon starts adb with my user ID and home folder.
- **Nothing in my home folder runs as root.** The installer copies the binaries into a root-owned directory, `/usr/local/lib/usbtether`. Otherwise any process running as me could replace a file that root later runs.
- **The health check talks SOCKS, not just TCP.** `adb forward` accepts connections on the Mac even when nothing is running on the phone, so a successful TCP connection proves nothing. The daemon sends a SOCKS5 greeting and waits for the proxy's reply.

The menu bar shows `📱 ↓1.2M` while connected, plus the totals, a Pause button for when I want to switch back to Wi-Fi, and a link to sing-box's built-in dashboard of live connections.

## How it behaves

On the first unplug-and-replug test, the daemon noticed the unplug within a second and restored normal networking. After I plugged the phone back in, it reconnected in about a second, with no input from me.

Speed depends on the phone's mobile signal, not on the USB link. I measured between 17 and 110 Mbit/s on 5G NSA, the 5G that runs on top of a 4G connection, depending on the moment. The phone also charges while tethering, at around 0.4 A, the standard USB 2.0 rate. That's slow, but enough to keep the battery gaining.

## Limits

- **No `ping`.** That kind of traffic (ICMP) isn't carried, only TCP and UDP.
- **IPv4 only** for now, which hasn't mattered for anything I use.
- **UDP is less efficient**, because it travels inside TCP. Video calls and QUIC still work.
- **USB debugging has to stay on,** and the phone's USB mode has to be File transfer rather than tethering.
- **Tested on one phone:** a Realme RMX3241 on Android 13, with an Apple Silicon Mac.

## The project I found afterwards

After all of this was working, I found [TetherKit](https://github.com/XiaoMiku01/TetherKit), a user-space RNDIS driver for macOS. It speaks RNDIS from a normal program using libusb and hands the network traffic to macOS through a virtual Ethernet pair. That's a more direct fix than mine. It uses the phone's own tethering, carries all traffic natively, and the author reports around 300 Mbps.

If your phone does RNDIS tethering and you just want it to work, try TetherKit first. My approach still has some advantages: it starts hands-free whenever the phone is plugged in, it works on any phone adb can reach, and every piece of networking code in it is sing-box, which is far more widely used. Still, it's a good reminder to search for a project's name a bit harder before building it.

## A note on carrier plans

Because the proxy on the phone opens its own connections, the mobile network sees ordinary traffic from the phone, not traffic forwarded from a tethered device. That's a side effect of how this works, not a way around your plan's terms. If your plan limits tethering, those terms still apply.

- Author: Kushal Patankar
- Published: 2026-12-03
- Category: Personal Software
- Topics: Personal Software, Android, macOS, USB Tethering, adb, sing-box, Go, Networking
- Reading time: 9 min read

## Continue reading
- [How to Build Personal Software: A Practical First-Tool Guide](https://peritissimus.com/blog/how-to-build-personal-software)
- [What Is Personal Software? Why I Build Tools for Myself](https://peritissimus.com/blog/what-is-personal-software)
- [Why I Upgraded the Screen I Visit Most After the Terminal](https://peritissimus.com/blog/new-tab-productivity)

---

HTML version: https://peritissimus.com/blog/android-usb-tethering-mac-adb  
Site index for agents: https://peritissimus.com/llms.txt  
Sitemap: https://peritissimus.com/sitemap-index.xml
