Skip to content

cuongducle/codex-linux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

95 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Codex Desktop

Codex Desktop for Linux

Unofficial native Linux packaging for OpenAI Codex Desktop

Latest Release Build APT Repo Platform

Codex Desktop is OpenAI's AI-powered coding agent โ€” shipped as an Electron app with no official Linux release. This project takes the upstream macOS build, patches it for Linux, and repackages it as a native .deb and .AppImage โ€” with Wayland support, rebuilt native modules, sandbox handling, and full desktop integration.

Important

THIS IS AN UNOFFICIAL BUILD. It is not affiliated with, endorsed by, or supported by OpenAI. No Codex source code is redistributed here โ€” this repo only contains the packaging scripts that build from the publicly available upstream macOS app. For the official product, see openai.com/codex. Use at your own risk.


๐Ÿ“ธ Screenshot

Codex Desktop running on Linux
Codex Desktop running natively on Linux (Wayland)

โœจ Features

Feature Details
๐Ÿ–ฅ๏ธ Native packaging .deb (Debian/Ubuntu) and .AppImage (any distro)
๐ŸŒ Wayland support Auto-detects Wayland with native window decorations, falls back to X11
๐Ÿ—๏ธ Rebuilt native modules Compiles better-sqlite3 and node-pty from source for Linux
๐Ÿ”„ Auto-updates Daily CI checks upstream, auto-tags and publishes new releases
๐Ÿ“ฆ APT repo One-line install with updates via apt upgrade
๐Ÿ›ก๏ธ Sandbox handling chrome-sandbox setuid + AppArmor userns profile (Ubuntu 24.04+)
๐Ÿ”ง Diagnostics Built-in --doctor command for troubleshooting
๐Ÿ”— Deep-linking x-scheme-handler/codex protocol support
๐ŸŽจ System integration Desktop entry, icon set, AppStream metainfo
๐Ÿ” Keyring fallback Falls back to basic encryption when no keyring is available
๐Ÿงน Crash recovery Auto-cleans stale SingletonLock on startup

Supported platforms

  • Architecture: x86_64 (amd64) and arm64
  • Ubuntu / Debian: 22.04+ (recommended 24.04+) via .deb
  • Any other distro: via .AppImage

โšก Installation

APT repository (auto-updates)

The recommended path on Debian/Ubuntu โ€” you get updates through apt upgrade:

echo "deb [trusted=yes] https://cuongducle.github.io/codex-linux/ stable main" \
  | sudo tee /etc/apt/sources.list.d/codex-desktop.list
sudo apt update && sudo apt install codex-desktop

One-line install

curl -fsSL https://cuongducle.github.io/codex-linux/install.sh | sudo bash

Manual .deb

Grab the latest .deb from Releases, then:

sudo dpkg -i codex-desktop-*.deb
sudo apt-get install -f   # pull in any missing dependencies

AppImage (any distro)

wget https://github.com/cuongducle/codex-linux/releases/latest/download/codex-desktop-linux-x86_64.AppImage
chmod +x codex-desktop-linux-x86_64.AppImage
./codex-desktop-linux-x86_64.AppImage

Note

The Codex CLI is a separate tool. Install it with: curl -fsSL https://chatgpt.com/codex/install.sh | sh


๐ŸŽฎ Usage

Launch from your app menu, or from a terminal:

codex-desktop

Diagnostics

codex-desktop --doctor

Prints display server, GPU, sandbox status, CLI resolution, platform info, and Electron version โ€” the first thing to run when something misbehaves.

Environment variables

Variable Default Description
CODEX_USE_X11 0 Force X11 (1) or auto-detect
CODEX_USE_WAYLAND 0 Force Wayland (1) or auto-detect
CODEX_DISABLE_VULKAN 0 Disable Vulkan (1)
CODEX_GL_BACKEND egl OpenGL backend (egl, desktop, swiftshader)
CODEX_PASSWORD_STORE basic Chromium password store backend
CODEX_DISABLE_SANDBOX 0 Disable Chromium sandbox (1)
CODEX_CLI_PATH auto Path to the Codex CLI binary

By default the app inspects WAYLAND_DISPLAY: if set, it launches with native Wayland (including window decorations); otherwise it falls back to X11.


๐Ÿ—๏ธ How It Works

Codex Desktop is an Electron application. The overwhelming majority of its code is cross-platform JavaScript, HTML, and CSS living inside an app.asar archive โ€” the only truly platform-specific parts are a couple of native Node modules. That makes it a good candidate for repackaging: pull the macOS build apart, rebuild the native bits for Linux, patch a few rough edges, and re-wrap it.

The packaging pipeline:

  1. Download the upstream macOS .dmg from OpenAI's CDN
  2. Extract the app.asar and bundled resources (icons, CLI binary)
  3. Rebuild native modules (better-sqlite3, node-pty) for the target Electron version and architecture
  4. Patch the app for Linux:
    • Disable BrowserWindow transparency (prevents black rectangles on software rendering)
    • Inject menu-bar visibility fix
    • Replace the upstream autoUpdater with a no-op (there's no Linux update feed)
    • Fix sidebar background rendering
  5. Package as .deb / .AppImage via electron-builder
  6. Install with proper sandbox permissions, an AppArmor profile, and desktop integration

Linux-specific workarounds applied during install:

  • chrome-sandbox is given chown root:root && chmod 4755 in postinst
  • An AppArmor profile grants userns (Ubuntu 24.04+ blocks unprivileged user namespaces by default)
  • The password store falls back to basic when kwallet / gnome-keyring is unavailable
  • Stale SingletonLock symlinks are cleaned on startup (prevents "app already running" false positives)

๐Ÿ”„ Auto-Update Pipeline

graph LR
    A[Daily cron] --> B[HEAD request<br/>upstream DMG]
    B --> C{ETag changed?}
    C -- No --> D[Skip]
    C -- Yes --> E[Download DMG]
    E --> F[Extract version]
    F --> G{Newer than<br/>latest tag?}
    G -- No --> D
    G -- Yes --> H[Commit + Tag]
    H --> I[Release workflow]
    I --> J[Build DEB + AppImage]
    J --> K[GitHub Release]
    J --> L[APT Repo]
Loading
  • check-upstream.yml โ€” runs daily, uses ETag-based change detection to avoid redundant downloads
  • release.yml โ€” triggered by version tags, builds x64 and arm64, publishes to GitHub Releases and the APT repo on gh-pages

๐Ÿ› ๏ธ Building from Source

# Clone
git clone https://github.com/cuongducle/codex-linux.git
cd codex-linux

# Download the upstream DMG
curl -fL "https://persistent.oaistatic.com/codex-app-prod/Codex.dmg" -o Codex.dmg

# Extract + rebuild native modules + set up local launcher
bash scripts/setup.sh ./Codex.dmg

# Build packages
npm run build:linux      # DEB + AppImage
npm run build:deb        # DEB only
npm run build:appimage   # AppImage only

Artifacts land in dist/.

Verify a build

bash scripts/smoke-verify.sh

๐Ÿ“‚ Repository Structure

โ”œโ”€โ”€ build/after-pack.js          # Electron post-pack: wrapper, CSS fixes, transparency patch
โ”œโ”€โ”€ scripts/
โ”‚   โ”œโ”€โ”€ setup.sh                  # DMG extraction + native rebuild + local launcher
โ”‚   โ”œโ”€โ”€ build-packages.sh         # DEB/AppImage build via electron-builder
โ”‚   โ”œโ”€โ”€ build-apt-repo.sh         # Debian repository metadata generation
โ”‚   โ”œโ”€โ”€ generate-apt-install-script.sh  # Public install.sh generator
โ”‚   โ”œโ”€โ”€ get-codex-version.sh      # Extract version from DMG
โ”‚   โ”œโ”€โ”€ smoke-verify.sh           # Post-install smoke test
โ”‚   โ”œโ”€โ”€ internal/
โ”‚   โ”‚   โ”œโ”€โ”€ extract-dmg.sh        # DMG โ†’ app.asar extraction
โ”‚   โ”‚   โ””โ”€โ”€ build-native.sh       # better-sqlite3 + node-pty rebuild
โ”‚   โ””โ”€โ”€ debian/
โ”‚       โ”œโ”€โ”€ postinst              # DEB post-install (sandbox perms + AppArmor)
โ”‚       โ””โ”€โ”€ postrm                # DEB post-remove (AppArmor cleanup)
โ”œโ”€โ”€ assets/
โ”‚   โ”œโ”€โ”€ icons/                    # Freedesktop icon set (16โ†’512px)
โ”‚   โ”œโ”€โ”€ screenshots/              # README screenshots
โ”‚   โ””โ”€โ”€ metainfo/                 # AppStream metainfo XML
โ”œโ”€โ”€ electron-builder.yml          # Packaging configuration
โ”œโ”€โ”€ .github/workflows/
โ”‚   โ”œโ”€โ”€ release.yml               # Build + publish on version tag
โ”‚   โ””โ”€โ”€ check-upstream.yml        # Daily upstream version check
โ””โ”€โ”€ README.md

โš ๏ธ Notes & Caveats

  • This is an unofficial project โ€” not affiliated with OpenAI.
  • It does not redistribute Codex source; it builds from the upstream .dmg.
  • The APT repo currently uses trusted=yes (unsigned repository).
  • The Codex CLI must be installed separately (see Usage).

๐Ÿ™ Credits

This project stands on the shoulders of the Linux community's earlier work packaging Electron-based AI desktop apps:


Built with โค๏ธ for the Linux community ยท Codexโ„ข is a trademark of OpenAI

About

Run Codex Desktop on Linux with a lightweight wrapper, Electron rebuild flow, and local setup script.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors