jackwener/OpenCLI · error · ConfigError
ChatGPT Desktop integration requires macOS (osascript is not
Error message
ChatGPT Desktop integration requires macOS (osascript is not available on this platform)
What it means
The `chatgpt-app new` command drives the ChatGPT macOS desktop app via AppleScript (`osascript`), which only exists on macOS. The library throws this ConfigError before doing any work when `process.platform !== 'darwin'`, because the integration cannot function on Linux or Windows.
Source
Thrown at clis/chatgpt-app/new.js:19
import { execSync } from 'node:child_process';
import { cli, Strategy } from '@jackwener/opencli/registry';
import { CommandExecutionError, ConfigError, getErrorMessage } from '@jackwener/opencli/errors';
import { isTemporaryChatVisible } from './ax.js';
export const newCommand = cli({
site: 'chatgpt-app',
name: 'new',
access: 'write',
description: 'Open a new chat in ChatGPT Desktop App',
domain: 'localhost',
strategy: Strategy.PUBLIC,
browser: false,
args: [
{ name: 'temp', type: 'boolean', default: false, help: 'Open a temporary chat with privacy protection' }
],
columns: ['Status'],
func: async (kwargs) => {
if (process.platform !== 'darwin') {
throw new ConfigError('ChatGPT Desktop integration requires macOS (osascript is not available on this platform)');
}
try {
execSync("osascript -e 'tell application \"ChatGPT\" to activate'");
execSync("osascript -e 'delay 0.5'");
if (kwargs.temp) {
const appleScript = [
'tell application "System Events"',
' tell process "ChatGPT"',
' try',
' click menu item "新的临时聊天" of menu "文件" of menu bar 1',
' on error',
' try',
' click menu item "新的臨時聊天" of menu "檔案" of menu bar 1',
' on error',
' try',
' click menu item "New Temporary Chat" of menu "File" of menu bar 1',
' on error',
' error "Unable to locate Temporary Chat menu item. Ensure Accessibility permissions are granted and the language is supported."' ,View on GitHub (pinned to 49907e53dc)
Solutions
- Run this command on macOS with the ChatGPT Desktop app installed
- Use the browser-based `chatgpt` commands (cookie/browser strategy) on non-macOS platforms
- Gate your script: only invoke chatgpt-app subcommands when process.platform === 'darwin'
Example fix
// before
await run('opencli chatgpt-app new --temp');
// after
if (process.platform !== 'darwin') await run('opencli chatgpt new --temp');
else await run('opencli chatgpt-app new --temp'); Defensive patterns
Strategy: validation
Validate before calling
if (process.platform !== 'darwin') {
throw new Error('chatgpt-app commands require macOS; use browser-based chatgpt commands instead');
} Type guard
const isMacOS = (): boolean => process.platform === 'darwin';
Try / catch
try {
await run('opencli chatgpt-app new');
} catch (e) {
if (String(e.message).includes('requires macOS')) {
await run('opencli chatgpt new'); // fallback path
} else throw e;
} Prevention
- Check process.platform === 'darwin' before invoking any chatgpt-app subcommand
- Prefer the browser-based `chatgpt` command family for cross-platform scripts
- Document platform requirements in your automation entrypoints
When it happens
Trigger: Running `opencli chatgpt-app new` (with or without --temp) on a non-macOS platform; the guard at the top of newCommand checks process.platform before any osascript call.
Common situations: CI runners on Linux, Docker containers, WSL without proper macOS targeting, or developers who confuse the browser-based `chatgpt` commands with the `chatgpt-app` desktop-app commands.
Related errors
- ChatGPT Desktop integration requires macOS (osascript is not
- ChatGPT Desktop integration requires macOS (osascript is not
- ChatGPT Desktop integration requires macOS (osascript is not
- Temporary chat did not become visible after selecting the me
- Failed to open ChatGPT chat:
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/5d0df30fd9229fda.
Report an issue: GitHub.