M
Melvynx
#AI coding#Codex#remote control

Codex AI: Remote Control Your Mac & VPS from iPhone

Learn how Codex AI integrates with your iPhone to remotely control your Mac and VPS via SSH. This guide covers setup, plugin installation, and managing projects from your mobile device.

5 min readAI Guide

Introduction

Introduction
Codex is an AI coding agent that offers robust remote control capabilities, allowing developers to manage their local machines (Mac) and remote servers (VPS) directly from a mobile application. This integration streamlines development workflows by enabling continuous interaction with coding projects and server environments from anywhere.

Configuration Checklist

Element Version / Link
Language / Runtime Not specified (assumed general coding environment)
Main library Codex Desktop App
Required APIs OpenAI Codex API (implied)
Keys / credentials needed OpenAI account credentials, SSH keys for VPS, NordVPN (optional for region-locked plugins)

Step-by-Step Guide

Step 1 — Connect Your iPhone to Codex Desktop

To enable remote control of your local machine, you need to link your iPhone to the Codex desktop application. This allows the mobile app to mirror and interact with your desktop environment.

  1. Open the Codex Desktop App.
  2. Navigate to Settings (bottom left corner).
  3. Click on Codex mobile to display a QR code.
  4. Open the ChatGPT app on your iPhone.
  5. Scan the QR code to establish the connection.
  6. Once connected, your iPhone will display the Codex interface, mirroring your desktop projects and chats.

Step 2 — Set up SSH Connections to Your VPS

Step 2 — Set up SSH Connections to Your VPS
Codex allows you to manage your Virtual Private Servers (VPS) directly from the mobile app via SSH connections. This is crucial for server administration and remote development.

  1. In the Codex Desktop App, go to Settings.
  2. Select Connections from the left sidebar.
  3. Click on the SSH tab.
  4. Click + Add SSH connection.
  5. Select an existing SSH connection from the list (e.g., coolify, steveclaw) or add one manually.
  6. In the connection details, ensure Allow Codex apps signed into your account to use this device is toggled on.

Once configured, you can select this SSH connection within the Codex mobile app to interact with your VPS. For example, to check Docker status:

# Example command to check Docker status on the connected VPS
Donne moi le status actuelle du docker Coolify si tout va bien et tout est bien connecter?
# Codex will then execute commands like:
# docker network ls --format "table {{.Name}}	{{.ID}}"
# docker ps --format "table {{.Names}}	{{.Image}}"
# docker compose ls
# docker logs -f coolify --since 30m --tail 200

Step 3 — Configure Sandbox Settings for SSH Connections

For more control over how Codex interacts with your SSH connections, you can adjust sandbox settings. This is important for security and defining permissions.

  1. In the Codex Desktop App, go to Settings.
  2. Select Host and then the specific SSH connection (e.g., coolify).
  3. Under Configuration, you can set the Approval policy (e.g., On request, Never) and Sandbox settings (e.g., Read only, Full access).

Step 4 — Install Computer Use and Chrome Plugins

Step 4 — Install Computer Use and Chrome Plugins
To enable Codex to control your local Mac applications and browser, you need to install specific plugins. Note that some plugins might be region-locked.

  1. If you are in a region where plugins like "Computer Use" and "Chrome" are not visible (e.g., Europe), use a VPN (e.g., NordVPN) to connect to a region like the United States.
    # Example: Connect to a VPN (e.g., NordVPN) to access region-locked plugins
    # [Editor's note: command/code to verify in the official documentation]
    
  2. In the Codex Desktop App, go to Plugins.
  3. Search for Computer Use and click Install Computer Use.
  4. Search for Chrome and click Install Chrome.
  5. Follow the prompts to install the Chrome extension in your browser.

Once installed, you can use the Codex mobile app to control your Mac's browser and other applications. For example, to open YouTube Music:

# Example command to open YouTube Music and play music on your Mac
Ouvre YouTube music et play my music avec computer use
# Codex will then use the 'dev-browser' skill to pilot the local interface.
# It will check if YouTube Music is open and use a 'Click' action to play music.

⚠️ Common Mistakes & Pitfalls

  1. Region-locked Plugins: Users in certain regions (e.g., Europe) may not see the "Computer Use" or "Chrome" plugins. Fix: Use a VPN to connect to a region like the United States to access and install these plugins.
  2. VPN Interference: Activating a VPN can sometimes disrupt existing connections between Codex and your local machine or VPS, leading to slower performance or disconnections. Fix: Be mindful of when and where you activate your VPN. If issues arise, try temporarily disabling the VPN or restarting Codex and your connections.
  3. Synchronization Delays: There might be slight delays in synchronization between the desktop app and the mobile app, especially when dealing with complex tasks or network latency. Fix: Allow some time for changes to propagate. If a task status isn't updating, try refreshing the mobile app or checking the desktop interface directly.
  4. Permission Management: Not setting appropriate Approval policy and Sandbox settings for SSH connections can lead to either excessive prompts for approval or unintended actions on your server. Fix: Carefully configure these settings based on your trust level and the sensitivity of the tasks you're performing. For critical operations, On request approval is recommended.

Glossary

Codex: An AI coding agent developed by OpenAI, designed to understand and generate code, and interact with development environments and systems.
SSH: (Secure Shell) A cryptographic network protocol for operating network services securely over an unsecured network. It's commonly used for remote command-line login and remote command execution.
VPS: (Virtual Private Server) A virtual machine sold as a service by an Internet hosting service. It runs its own copy of an operating system, and customers may have superuser-level access to that operating system instance.

Key Takeaways

  • Codex offers seamless integration between desktop and mobile apps, allowing remote control of development environments.
  • You can manage both your local Mac and remote VPS instances directly from the Codex mobile app.
  • SSH connections enable robust interaction with remote servers, including executing commands and monitoring services.
  • The "Computer Use" and "Chrome" plugins extend Codex's capabilities to control local applications and browser activities on your Mac.
  • Project and chat synchronization between desktop and mobile ensures continuity in your workflow.
  • Customizable sandbox settings provide control over permissions and approval policies for executed commands.
  • The ability to multitask across different projects and environments from a single mobile interface significantly enhances productivity.

Resources

*Editor's note: The video mentions mlv.sh/formation-ai which redirects to codelynx.dev.)