Tools12 min read

How I Run Claude Code From My Phone

I set up Claude Code on a cheap cloud server so I can code with AI from my iPhone. Here's the whole journey, including all the mistakes and aha moments.

Daniel Dahlen

Daniel Dahlen

January 21, 2025

I'm sitting on the couch with my phone. Got an idea for a feature. Open Termius, connect to my server, tell Claude what I want. A few minutes later, the code is written, tested, and pushed to GitHub.

This is my actual setup. I figured I'd document how I put it together.

TL;DR

  • What you get: Claude Code accessible from your iPhone/Android, anywhere
  • Cost: ~$10/month (€9)
  • Setup time: 30-60 minutes if you follow this guide
  • Prerequisites: Basic terminal navigation (cd, ls, etc.). Or being able to ask an AI model how to do it :)

Why I Wanted This

I use Claude Code daily on my Mac. It's incredibly powerful. But I wanted to keep working when I'm away from my computer. From the couch, on the train, in the waiting room at the dentist. (Okay, I'll admit it... the bathroom too.)

The problem is that Claude Code requires a real computer. It's a command-line tool that needs Node.js. There's no mobile app.

The solution? Run it on a cloud server and connect from my phone.

The solution actually turned out really well:

  • Full Claude Code experience on my phone
  • Push notifications when Claude needs my input
  • Can view local web servers directly in Safari
  • Everything syncs between phone and computer

Choosing a Server

I chose Hetzner for three reasons:

  1. EU-based (GDPR compliance and proximity)
  2. Affordable (really affordable)
  3. Good performance for the price

Here are their server options:

| Model | CPU | RAM | Price/month | Good for | |-------|-----|-----|-------------|----------| | CX22 | 2 vCPU | 4 GB | ~€4 | Light usage | | CX32 | 4 vCPU | 8 GB | ~€8 | My pick | | CX42 | 8 vCPU | 16 GB | ~€17 | Heavy projects |

I run CX32 for about €8.50 per month. Plus €0.60 for the IPv4 address. Total around $10/month.

Why CX32?

Claude Code can sometimes run heavy operations (npm install, builds, tests). With 8 GB RAM and 4 vCPU, I've never hit any issues. CX22 works for simpler stuff, but I wanted some headroom.

Setting Up the Server Step by Step

1. Create an Account on Hetzner

Go to hetzner.com/cloud and create an account. You'll need to verify with a credit card.

2. Create a New Server

  1. Click "Add Server"
  2. Choose Location: Pick the one closest to you (I chose Falkenstein)
  3. Choose Image: Ubuntu 24.04
  4. Choose Type: CX32 (or whatever you prefer)
  5. Under Networking: Make sure IPv4 is enabled

What's Ubuntu?

Ubuntu is an operating system (like Windows or macOS, but for servers). 24.04 is just the version number. It's the most popular choice for servers and most things work out of the box.

3. SSH Keys

SSH keys are like a super-strong password that consists of two parts: a private key (that you keep secret) and a public key (that you give to the server).

The trick is that you can create SSH keys directly in Termius. So I'll skip this step here and handle it in Termius instead.

4. Create the Server

Click "Create & Buy". It takes about 30 seconds for the server to start up. You'll get an IP address that looks something like 168.119.xxx.xxx.

Termius: Your Way In

Termius is the app that makes everything possible. It's available for both iOS and Android, and it syncs across all your devices.

1. Download and Create an Account

Get Termius from the App Store/Google Play. Create a free account (no payment needed).

2. Create an SSH Key in Termius

Here's the smart trick:

  1. Open Termius
  2. Go to Keychain (the key icon)
  3. Tap + and select Generate Key
  4. Give it a name (e.g., "hetzner")
  5. Choose ED25519 as the type
  6. Tap Save

Now you have an SSH key. Copy the public key by tapping on the key and then Copy to Clipboard (the one that starts with "ssh-ed25519").

3. Add the Key to Hetzner

  1. Go back to the Hetzner Cloud Console
  2. Go to SecuritySSH Keys
  3. Click Add SSH Key
  4. Paste your public key
  5. Give it a name and save

If you've already created the server without an SSH key, you can:

  1. Go to your server
  2. Click RescueEnable Rescue Mode
  3. Follow the instructions to add the key

Or easier: delete the server and create a new one with the key selected from the start. You pay by the hour, so it costs almost nothing.

4. Connect for the First Time

In Termius:

  1. Go to Hosts
  2. Tap + and select New Host
  3. Fill in:
    • Label: Something descriptive (e.g., "Claude Server")
    • Address: Your server's IP address
    • Username: root
    • Keys: Select the key you created
  4. Save and tap on the host to connect

You should see something like:

root@ubuntu-4gb-fsn1-1:~#

It works! You're on your server. From your phone.

Installing the Stuff

Now let's install what we need. Copy and paste these commands one at a time.

1. Update the System First

apt update && apt upgrade -y

This might take a few minutes. If it asks about kernel upgrades, just choose to continue.

Restart May Be Needed

If you see a message about restarting, run reboot and wait 30 seconds before reconnecting.

2. Install Node.js

curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt install -y nodejs

Verify it worked:

node --version

You should see something like v22.x.x.

3. Install tmux

apt install -y tmux

Tmux is super important. More on that soon.

4. Install Claude Code

npm install -g @anthropic-ai/claude-code

5. Log In to Claude

claude

The first time, you'll be asked to choose a login method. Choose to log in via the browser. You'll get a link in the terminal that you need to copy and open in your phone's (or computer's) browser. There you authenticate with your Anthropic account.

Once that's done, you're ready!

tmux: Why Your Sessions Don't Die

Here's the most important part for mobile usage: tmux.

The problem without tmux: You start Claude Code, close Termius to reply to a text message, and when you come back the session is dead. Everything you were working on is gone.

Tmux solves this by creating "virtual rooms" that keep running even when you're not connected.

The Basics

Start a new tmux session:

tmux new -s claude

Now you're inside tmux. Everything you do here survives even if you lose connection.

Detach (Without Closing)

Press Ctrl+B, release, then press D.

You're back in the regular terminal, but your session lives on.

Reattach to the Session

tmux attach -t claude

Boom. Everything is exactly as you left it.

Multiple Sessions

You can have multiple projects running simultaneously:

tmux new -s project1
tmux new -s project2

List all sessions:

tmux ls

Tmux on Mobile

On a phone keyboard, Ctrl+B can be tricky. In Termius, you can tap "Ctrl" in the toolbar, then B, then D. Or configure a custom shortcut.

Scrolling in tmux

One thing that confused me: you can't just swipe to scroll up in tmux.

The solution: Press Ctrl+B, then [. Now you're in "copy mode" and can scroll with swipes or arrow keys. Press Q to exit.

Push Notifications That Actually Work

This is a game-changer: get notifications on your phone when Claude needs your input.

I used ntfy.sh which is free and requires no setup.

1. Download the ntfy App

Get "ntfy" from the App Store or Google Play.

2. Subscribe to a Topic

In the app, tap + and type in a unique topic. For example: claude-daniel-12345 (make it unique so no one else accidentally subscribes to the same one).

3. Create a Notify Script on the Server

nano ~/notify.sh

Paste:

#!/bin/bash
curl -s -d "$1" ntfy.sh/claude-daniel-12345

Replace claude-daniel-12345 with your topic.

Save with Ctrl+X, Y, Enter.

Make the script executable:

chmod +x ~/notify.sh

4. Test It

~/notify.sh "Hello from the server!"

You should get a notification on your phone. First time I got this working was pretty satisfying.

5. Configure Claude Code to Use It

Create a settings file:

mkdir -p ~/.claude
nano ~/.claude/settings.json

Paste:

{
  "hooks": {
    "Stop": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "/root/notify.sh 'Claude needs input!'"
          }
        ]
      }
    ]
  }
}

My Mistake: Wrong Format

I first got errors because I had "command": ["/root/notify.sh", "message"] instead of a single string. Claude Code hooks want the command as a string, not an array.

Now you'll get a notification every time Claude stops and waits for input. Perfect when you're running something in the background and want to know when it's done.

Viewing Localhost From Your Phone

When Claude builds a web app and starts a local server (like npm run dev on port 3000), how do you see it from your phone?

The answer is port forwarding in Termius.

Configure Port Forwarding

  1. In Termius, go to your host
  2. Tap the ⚙️ (settings) for the host
  3. Scroll down to Port Forwarding
  4. Tap Add Rule
  5. Fill in:
    • Local Port: 3000
    • Remote Host: localhost (or leave empty)
    • Remote Port: 3000
  6. Save

Now, when you're connected to the server and have an app running on port 3000, open Safari and go to:

http://localhost:3000

You see the app. Right on your phone. It's a bit magical the first time.

Multiple Ports

Add more rules for other ports you use often. I have 3000, 3001, 5173 (Vite), and 8080 configured.

Folder Structure and Daily Workflow

I keep it simple on the server:

~/projects/
├── maivor-main/
├── sideproject-x/
└── experiment-y/

My Daily Flow

  1. Open Termius and connect to the server
  2. Reattach to tmux: tmux attach -t claude (or create a new session)
  3. Go to the project: cd ~/projects/my-project
  4. Start Claude: claude
  5. Work!

When I'm done, I just press Ctrl+B, D to detach from tmux. The session lives on if I want to continue later.

Quick-Start Script

I created a small script to get going faster:

nano ~/start-claude.sh
#!/bin/bash
cd ~/projects/$1
tmux new -s $1 -d
tmux send-keys -t $1 "claude" Enter
tmux attach -t $1
chmod +x ~/start-claude.sh

Usage:

~/start-claude.sh maivor-main

It goes to the right folder, creates a tmux session with the same name, starts Claude, and attaches you.

Bonus: Whispr Flow for Voice Input

Typing long prompts on a phone keyboard isn't always fun. This is where Whispr Flow comes in.

Whispr Flow is an app that lets you speak instead of type. It uses OpenAI's Whisper model to transcribe what you say, then pastes the text wherever you are.

So instead of pecking at the keyboard in Termius, I can just hold down a button, say what I want Claude to do, and release. The text appears in the terminal.

It works surprisingly well for code-related instructions. "Create a new React component called UserProfile with props for name and email" becomes exactly that.

Bonus: Same Setup on Mac

One more thing: Termius syncs across devices.

This means you can:

  1. Install Termius on your Mac (free)
  2. Log in with the same account
  3. All your hosts, keys, and settings are there

So you can start working on your phone, continue on your computer, and it's all the same server and same tmux sessions.

Tips and Gotchas

Here are things I learned the hard way:

Kernel Upgrade

After apt upgrade, there might be a question about restarting. Do it. Run reboot and wait half a minute before reconnecting.

Tmux Scroll on Mobile

Use Ctrl+B, [ to enter scroll mode. Swipe or use arrow keys. Q to exit.

Hooks Format in Claude Code

The command should be a string, not an array:

// Correct
"command": "/root/notify.sh 'message'"
 
// Wrong
"command": ["/root/notify.sh", "message"]

Bind Address in Port Forwarding

You can leave "Remote Host" empty in Termius. It defaults to localhost.

Session Name in Notifications

Want to know which session needs you? Change the notify command:

/root/notify.sh "[$TMUX_PANE] Claude needs input!"

Cost Summary

| Item | Cost | |------|------| | Server (CX32) | €8.50/month | | IPv4 address | €0.60/month | | Total | ~€9.10/month (~$10) |

Termius basic version is free. ntfy is free.

If you want to save money when you're not using the server, you can take a snapshot and delete the server. Then recreate it from the snapshot when you need it again. But for $10/month, I usually just let it run.

A Few Final Words

It took me an afternoon to set all this up. And that included all the mistakes, troubleshooting, and "why isn't this working?!" moments.

Now I have Claude Code in my pocket. Literally.

Is it the same as sitting at my computer with a big screen and a real keyboard? No. But for quick changes, code review, or starting something that can run in the background? It's perfect.

And the feeling of sitting on the couch and deploying a feature to production... that's something else entirely.


Have questions about the setup or got stuck somewhere? Get in touch and I'll help you out.

Claude CodeHetznerTermiusmobile developmenttmuxSSH

Liked this article?

Share it with your network

Related articles

Need help with AI?

We help businesses implement AI solutions that actually work. Book a free consultation.

Book consultation