Skip to content

CodeNavi on macOS

There are two ways to use CodeNavi on a Mac:

  • The server on the Mac itself (Apple Silicon, installed by the install command): it runs in Podman, and the embedding model runs in Ollama on the Mac's GPU. See Run the CodeNavi server on a Mac.
  • Your agent on the Mac, the server on a Linux machine with a GPU: this page. The agent connects to the server over the network. This page shows the steps: get a server, connect the Mac, wire your agent, keep the index current, and stop the server when you do not need it.1

Why a Linux server

  • A server elsewhere keeps the Mac's memory free for your work. On a 16 GB Mac, chat during a full index makes the Mac swap heavily (see the Mac server page).
  • One server can serve the whole team.
  • The Linux server is a linux/amd64 image with a different GPU stack from the Mac build, so use the Linux install for it.

The Linux installer refuses macOS. Run on a Mac, the one-command install stops before it downloads anything, so you lose no time and your download link stays valid; it points to the two Mac options above.2

1. Get a server

You have Do this
A Linux machine with an NVIDIA or AMD GPU (a workstation, an office box) Run the install command on it: setup guide
No GPU machine A GPU VM in your own AWS or Google Cloud account, one step each: cloud GPU VM
A team that shares one server Team server

Run the install command on the Linux machine, not on the Mac. For a trial, pick the Linux machine's GPU on the trial form (NVIDIA or AMD), not Apple Silicon Mac: a Mac trial carries only the Mac build, and its install link does not install on Linux. On a paid plan, use the Linux command on the Install CodeNavi card in your portal.

A cloud VM bills by the hour while it runs: the AWS g6.xlarge the one-step install uses listed at about $0.80 per hour in 2026, so about $590 a month if it never stops, and only the disk and the Elastic IP while stopped. Stop it when you do not use it, and delete it when you are done (updates and teardown).

2. Connect the Mac

The simplest connection is an SSH tunnel from the Mac to the server. Port 8765 stays closed to the internet; only SSH is open.

mv ~/Downloads/my-key.pem ~/.ssh/     # where ssh looks for keys; the AWS stack's commands use this path
chmod 400 ~/.ssh/my-key.pem           # once: ssh refuses a key file other users can read
ssh -N -o ServerAliveInterval=30 -o ExitOnForwardFailure=yes \
    -L 8765:localhost:8765 -i ~/.ssh/my-key.pem ubuntu@<server-ip>

On the AWS one-step install, the stack's TunnelCommand output is this command with your values. On the Google Cloud one-step install, the gcloud command-line tool (installed and logged in on the Mac) makes the key and finds the address:

gcloud compute ssh codenavi --project <project> --zone <zone> -- -N \
    -o ServerAliveInterval=30 -o ExitOnForwardFailure=yes -L 8765:localhost:8765

Keep the Terminal window open: the tunnel stops when the window closes, the Mac sleeps or the network changes. Run the command again to reconnect.

Keep the tunnel up without a Terminal window (optional). A launchd agent restarts the tunnel about ten seconds after any drop, including wake from sleep. It needs a key without a passphrase. Save this as ~/Library/LaunchAgents/com.codenavi.tunnel.plist, with your key name, user and server address:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict>
  <key>Label</key><string>com.codenavi.tunnel</string>
  <key>ProgramArguments</key><array>
    <string>/usr/bin/ssh</string><string>-N</string>
    <string>-o</string><string>ServerAliveInterval=30</string>
    <string>-o</string><string>ExitOnForwardFailure=yes</string>
    <string>-o</string><string>StrictHostKeyChecking=accept-new</string>
    <string>-L</string><string>8765:localhost:8765</string>
    <string>-i</string><string>/Users/YOU/.ssh/my-key.pem</string>
    <string>ubuntu@SERVER-IP</string>
  </array>
  <key>RunAtLoad</key><true/>
  <key>KeepAlive</key><true/>
  <key>ThrottleInterval</key><integer>10</integer>
</dict></plist>

Then launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.codenavi.tunnel.plist. It starts at every login. To stop it: launchctl bootout gui/$(id -u)/com.codenavi.tunnel. When the server is down, the agent keeps retrying quietly; the agents on the Mac then fall back to their own file search without a message, so check http://localhost:8765/health first when search results look thin.

The tunnel uses port 8765 on the Mac too, so every plugin and agent config works with its default address. If the command stops with Address already in use, something on the Mac already holds 8765. Pick another local port (-L 18765:localhost:8765) and use that port in the URLs below.

Then open http://localhost:8765/connect in your browser. The page checks the connection and gives the exact settings for your agent.

On a LAN or a private network you can skip the tunnel and point the agent at the server's address: remote access covers the token, the firewall and HTTPS.

3. Wire your agent

Point the agent at http://localhost:8765/mcp (through the tunnel) with your auth token. The per-agent pages have the details: connecting your agent.

The auth token is in ~/codenavi/.env on the server (CODENAVI_AUTH_TOKEN). Copy it to the Mac over SSH, into a file only you can read, and export it from ~/.zprofile; do not paste it into a command line, where your shell history keeps it:

ssh -i ~/.ssh/my-key.pem ubuntu@<server-ip> 'sed -n s/^CODENAVI_AUTH_TOKEN=//p ~/codenavi/.env' > ~/.codenavi-token
chmod 600 ~/.codenavi-token
echo 'export CODENAVI_AUTH_TOKEN=$(cat ~/.codenavi-token)' >> ~/.zprofile

On the Google Cloud one-step install the server belongs to the codenavi user, so the first line is this one; the other two are the same:

gcloud compute ssh codenavi --project <project> --zone <zone> \
    --command 'sudo sed -n s/^CODENAVI_AUTH_TOKEN=//p /opt/codenavi/codenavi/.env' > ~/.codenavi-token

~/.zprofile is read at login, so apps started from the Dock (Cursor, VS Code, Claude Desktop, the Antigravity app) see the variable too, not only Terminal. Log out and in once after adding the line. Every agent page below reads the token from that variable.

Python for the plugin hooks. The Claude Code, Codex, Cursor and Antigravity plugins run small Python hooks. They need python3 3.9 or newer on the PATH. macOS provides 3.9 through the Xcode Command Line Tools (xcode-select --install; on a Mac without them, python3 is a stub that only offers to install the tools). Servers older than 1.3.60 ship hooks that need 3.10, so on those install Homebrew Python (brew install python) or use the MCP tools without the plugin.

4. Keep the index current

The server searches its own copy of your repository, not the files on your Mac. Search follows what you push: the one-step cloud installs pull and reindex every 5 minutes (keeping the index current); on your own server, add the same schedule from team server. Edits you have not pushed are not in search results yet, and line numbers can differ from your local file until you push.

To sync at once after a push, run the sync script on the server:

ssh -i ~/.ssh/my-key.pem ubuntu@<server-ip> '~/codenavi-sync.sh'             # AWS one-step install
gcloud compute ssh codenavi --project <project> --zone <zone> \
    --command 'sudo -u codenavi /opt/codenavi/codenavi-sync.sh'              # Google Cloud one-step install

5. A working day

A cloud VM costs by the hour, so start it when you begin and stop it when you finish. The index and the settings stay on its disk.

# AWS
aws ec2 start-instances --instance-ids <InstanceId>
aws ec2 stop-instances --instance-ids <InstanceId>

# Google Cloud
gcloud compute instances start codenavi --project <project> --zone <zone>
gcloud compute instances stop codenavi --project <project> --zone <zone>

<InstanceId> is an output of the AWS stack. The AWS stack's Elastic IP keeps the server's address the same; gcloud finds the new one by name.

  1. Start the VM. The server starts with it.
  2. Open the tunnel, then run curl -s http://localhost:8765/health until it answers "status":"ok".
  3. Work and push. Commits pushed while the VM was off are pulled within 5 minutes.
  4. Stop the VM when you finish. Closing the MacBook does not stop it.

Good to know

  • Licence. Every plan covers the tunnel: with a Personal licence you may reach your own server from your Mac through your own SSH tunnel. A direct connection without a tunnel needs Professional or Corporate (remote access).
  • SSH times out on another network. The one-step installs allow SSH from one IP address only, and a MacBook changes address when it changes network. Find the new one with curl -4 https://checkip.amazonaws.com, then:

    • AWS: in the EC2 console open the instance's Security tab, open its security group and edit the port 22 rule. Do not update the CloudFormation stack for this: an update can pick up a newer machine image and replace the instance, and its index with it.
    • Google Cloud: gcloud compute firewall-rules update codenavi-ssh --project <project> --source-ranges <your-ip>/32
  • Paths in results are the server's paths. Keep the same repository layout and the relative paths match your checkout.

  • Distance adds latency. Every search makes a round trip to the server. A server in a region near you keeps searches fast.

  1. Vendor change reference CN-896. ↩

  2. Vendor change reference CN-898. ↩