Unofficial native Linux packaging for OpenAI Codex Desktop
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.
| 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 |
- Architecture:
x86_64(amd64) andarm64 - Ubuntu / Debian: 22.04+ (recommended 24.04+) via
.deb - Any other distro: via
.AppImage
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-desktopcurl -fsSL https://cuongducle.github.io/codex-linux/install.sh | sudo bashGrab the latest .deb from Releases, then:
sudo dpkg -i codex-desktop-*.deb
sudo apt-get install -f # pull in any missing dependencieswget 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.AppImageNote
The Codex CLI is a separate tool. Install it with:
curl -fsSL https://chatgpt.com/codex/install.sh | sh
Launch from your app menu, or from a terminal:
codex-desktopcodex-desktop --doctorPrints display server, GPU, sandbox status, CLI resolution, platform info, and Electron version โ the first thing to run when something misbehaves.
| 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.
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:
- Download the upstream macOS
.dmgfrom OpenAI's CDN - Extract the
app.asarand bundled resources (icons, CLI binary) - Rebuild native modules (
better-sqlite3,node-pty) for the target Electron version and architecture - Patch the app for Linux:
- Disable
BrowserWindowtransparency (prevents black rectangles on software rendering) - Inject menu-bar visibility fix
- Replace the upstream
autoUpdaterwith a no-op (there's no Linux update feed) - Fix sidebar background rendering
- Disable
- Package as
.deb/.AppImageviaelectron-builder - Install with proper sandbox permissions, an AppArmor profile, and desktop integration
Linux-specific workarounds applied during install:
chrome-sandboxis givenchown root:root && chmod 4755inpostinst- An AppArmor profile grants
userns(Ubuntu 24.04+ blocks unprivileged user namespaces by default) - The password store falls back to
basicwhenkwallet/gnome-keyringis unavailable - Stale
SingletonLocksymlinks are cleaned on startup (prevents "app already running" false positives)
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]
check-upstream.ymlโ runs daily, uses ETag-based change detection to avoid redundant downloadsrelease.ymlโ triggered by version tags, buildsx64andarm64, publishes to GitHub Releases and the APT repo ongh-pages
# 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 onlyArtifacts land in dist/.
bash scripts/smoke-verify.shโโโ 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
- 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).
This project stands on the shoulders of the Linux community's earlier work packaging Electron-based AI desktop apps:
- k3d3/claude-desktop-linux-flake โ Nix flake approach; inspiration for native-addon stubbing and
app.asarsurgery techniques. - aaddrick/claude-desktop-debian โ Debian packaging approach; inspiration for AppArmor profiles, Wayland handling, and Proxy-based Electron interception.
