cube.

Guides

Let Claude Code work through the night on a Mac in Japan

Hand it a task before bed and read the results over breakfast. We set this up from scratch on a Mac and wrote down every command, timing and mistake.

Last checked · Claude Code 2.1.332 · About 12 minutes to read

The short answer

Install Claude Code on a Mac that stays on, start Remote Control inside tmux, and take over from your phone. Your own computer can close or shut down while the task keeps running on that Mac. It takes about twenty minutes.

This page is written by cube. We rent Mac minis located in Japan. The steps work just as well on a Mac of your own.

Sound familiar?

  • You ask the AI to refactor a module before bed. In the morning it has been stuck since 1 a.m., because the laptop went to sleep when you closed the lid.
  • The train goes into a tunnel, the network drops, and the long task drops with it.
  • Halfway through it needs you to click "Allow". You are away from the computer, so it waits.
  • You join a video call, the fans spin up, and the AI and the meeting both slow down.

The AI is clever enough. The place it lives is not steady enough.

It depends on the computer it runs on

Claude Code uses the files and tools of the computer that runs it. Anthropic's documentation is clear: your phone and the web are only a window, the real work happens in a process on that computer, so the computer must stay on and the process must keep running.

The connection is simple: your phone or browser → Anthropic's servers → that Mac. The Mac only makes outbound HTTPS connections and opens no ports. Code runs, and files stay, on that Mac.

Why Japan

If you are in East Asia, Japan is close. On a computer connected to Japanese home broadband (not the line our rentals use) we measured a 42 ms round trip to Seoul and 64 ms to Hong Kong. Checking progress and approving actions from your phone feels immediate.

The machine stays in one place in Japan, so its network does not jump from Tokyo today to Singapore tomorrow. For AI work that stays signed in and runs for hours, that consistency matters.

These figures come from a single run. Your own network will change the results.

Three ways to run it

After you close the laptopYour laptopThe task stopsA Mac mini at home or workIt continuesA rented remote MacIt continues
After a power cut or freezeYour laptopYou deal with itA Mac mini at home or workSomeone has to be thereA rented remote MacThe provider deals with it
Up-front costYour laptopNoneA Mac mini at home or workBuying a machineA rented remote MacRent paid quarterly
Good forYour laptopShort tasksA Mac mini at home or workPeople nearby who like maintaining hardwareA rented remote MacPeople away from the machine, or who would rather not manage hardware

Before you start

  • A Mac that stays on, running macOS 13 or later. We tested on macOS 26.6.2.
  • Your own Claude subscription. Remote Control works with Pro, Max, Ultra, Team and Enterprise. API keys are not supported.
  • The Claude app on your phone, or any browser.
  • A project folder just for the AI. Keep only what the project needs there, and leave out passwords, private keys and personal files.

Step 1: Keep the Mac awake for good

If you rent from cube., we take care of this step. Skip to step 2.

On your own Mac, stop it sleeping and have it restart after a power cut. Open Terminal and run these one at a time (you will need an administrator password):

sudo pmset -a sleep 0
sudo pmset -a autorestart 1
sudo pmset -a womp 1

They turn off sleep, restart the Mac when power returns, and allow it to wake over the network. Run pmset -g afterwards; the sleep line should read 0.

No administrator rights? You can keep the Mac awake only while a task runs:

caffeinate -i

The Mac stays awake while that window is open. Press Ctrl+C to stop.

About FileVault:on a Mac with disk encryption, a restart waits for a password before macOS starts, and remote work waits there too until someone unlocks it. Our test Mac has FileVault on. Run fdesetup status to check yours. Whether to turn it off depends on where the machine sits and who can reach it.

Step 2: Install tmux and Claude Code

First install tmux, which keeps tasks running after you close the window. It took about twenty seconds for us:

brew install tmux

Then install Claude Code, about fifteen seconds:

curl -fsSL https://claude.ai/install.sh | bash

If the installer says ~/.local/bin is not in your PATH, run this once:

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc

Run claude --version. A version number means you are set. We got 2.1.332.

Step 3: Sign in from the command line

claude auth login

A browser opens an authorisation page. Approve it, then go back to Terminal and check:

claude auth status

You are signed in when it shows "loggedIn": true.

Step 4: Start it inside tmux

tmux new -s work
cd ~/your-project-folder
claude remote-control --name "My Project"

The first time, it asks two questions: whether you trust this folder, and whether to enable Remote Control. Type y for both. About ten seconds later Terminal shows "Connected".

Now press Ctrl+b, let go, then press d. You have left tmux, and the task keeps running in the background.

Step 5: Take over from your phone

Inside tmux, press the spacebar to show a QR code and scan it with your phone, or open "My Project" from the session list at claude.ai/code.

You can now close the remote desktop and your own laptop. When the AI needs your approval, tap it on your phone.

When you need to click on screen

Some things macOS only accepts on screen: privacy permissions in System Settings, certain password prompts, a sign-in in the browser. The command line cannot help there, so open the Mac's screen with a remote desktop and click. On a Mac rented from cube., use UU Remote.

Mistakes we made

  • `claude` not found after installing. On a freshly set up Mac, opening a new Terminal window did not help. Fix the PATH first.
  • Thinking we were signed in when we were not. Being signed in to the desktop app or the website does not sign in the command line. We got stuck here once. When unsure, run claude auth status. Starting without signing in shows "You must be logged in to use Remote Control".
  • Connecting to the wrong session. The session list can hold more than one session. The first time we asked it to create a file, the file was not in our test folder. Always give the session a clear name with --name and check it when you connect.
  • Closing the window ends the task. Started outside tmux, the process ends when you close the Terminal window.

Running for days: what to watch

  • Logins expire. After we signed in, loginExpiresAt in claude auth status showed a date about a month away (our test). Put it in your calendar and run claude auth login again before then.
  • Skip the long-lived token. Some guides suggest a one-year token from claude setup-token. Anthropic's documentation says these tokens cannot start Remote Control sessions, and you will see "Remote Control requires a full-scope login token". For Remote Control, sign in with claude auth login (official documentation).
  • A long network outage ends the process. After roughly ten minutes without a network, claude remote-control exits on its own (official documentation). Once the network is back, return to tmux and run claude remote-control --continue in the same folder.
  • Permission requests wait for you. Approval requests stay open until you answer. Other kinds of dialog wait five minutes by default, then close with the "do nothing" choice (official documentation).

If you see one of these messages

zsh: command not found: claudeWhyPATH is not set (our test)What to doRun the PATH command from step 2
"You must be logged in to use Remote Control"WhyThe command line is not signed in (our test)What to doRun claude auth login
"Remote Control requires a full-scope login token"WhyA long-lived token is in use (official documentation)What to doRun claude auth login
"Remote Control disconnected" or "Can't reach"WhyYour phone or browser lost contact with the Mac; the task may still be running (official documentation)What to doRun tmux attach -t work and check the terminal

Day-to-day care

See the background sessionsCommandtmux ls
Go back to a background sessionCommandtmux attach -t work
Pick up the previous session after a disconnectCommandRun claude remote-control --continue in the same folder; works for about four hours
Update Claude CodeCommandclaude update
Check the installationCommandclaude doctor
See how much disk is leftCommanddf -h /

Working on several projects? Give each one its own tmux session and its own Remote Control, each with a different name. Disk use grows with every project, so check it now and then.

Security, in one minute

  • Only trust folders you know. Once trusted, a session can read, change and run files there, and the folder's project settings apply.
  • Keep the default permission mode for now. claude remote-control accepts --permission-mode. Relaxing approvals lets the AI move faster, and also means it stops asking you before each step.
  • Transcripts pass through Anthropic. While connected, your conversation is stored on Anthropic's servers to keep your devices in sync. If that matters to you, read the "Connection and security" section of the official documentation, which also covers Trusted Devices.
  • Account rules. Using Claude means following Anthropic's terms, and we cannot guarantee that third-party accounts will never be restricted.

When you do not need a second Mac

  • Your tasks finish in a few minutes and your computer is on anyway.
  • Your project only needs Linux. An ordinary cloud server will do.
  • You want to use an API key and not a subscription. Remote Control does not support that today.

One-page checklist

  • The Mac stays on, never sleeps and restarts after a power cut
  • claude --version prints a version and claude auth status shows you are signed in
  • Started inside tmux, with a name set by --name
  • The named session shows on your phone, and you have approved one action
  • You know tmux attach -t work and claude update
  • Your login expiry date is in your calendar

Want an always-on Mac in Japan?

cube. rents whole Mac minis on shared Japanese business broadband, with everything included. We keep the Mac awake and bring it back after a power cut, so you can simply hand the work to the AI. Applying is free, and you pay only after we approve your application.

Apply nowReview first, pay after approval

Sources

Timings, version numbers and network figures come from our own test on 29 November 2026: Claude Code 2.1.332, tmux 3.8, macOS 26.6.2.

Oil painting: craftsmen build a tower of mini computers as ships bring more