Just use iSH and use the local terminal on the iPhone from which you can connect to the Mac terminal. Works well over tailscale, too.

How do I know iSH app isn’t exfiltrating data?