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 send` command sends a message into the ChatGPT Desktop app via AppleScript, macOS-only. It throws this ConfigError up front when `process.platform !== 'darwin'`, before the message text is used, because osascript is not available on other platforms.

Source

Thrown at clis/chatgpt-app/send.js:19

import { cli, Strategy } from '@jackwener/opencli/registry';
import { CommandExecutionError, ConfigError, getErrorMessage } from '@jackwener/opencli/errors';
import { activateChatGPT, selectModel, MODEL_CHOICES, sendPrompt } from './ax.js';
export const sendCommand = cli({
    site: 'chatgpt-app',
    name: 'send',
    access: 'write',
    description: 'Send a message to the active ChatGPT Desktop App window',
    domain: 'localhost',
    strategy: Strategy.PUBLIC,
    browser: false,
    args: [
        { name: 'text', required: true, positional: true, help: 'Message to send' },
        { name: 'model', required: false, help: 'Model/mode to use: auto, instant, thinking, 5.2-instant, 5.2-thinking', choices: MODEL_CHOICES },
    ],
    columns: ['Status'],
    func: async (kwargs) => {
        if (process.platform !== 'darwin') {
            throw new ConfigError('ChatGPT Desktop integration requires macOS (osascript is not available on this platform)');
        }
        const text = kwargs.text;
        const model = kwargs.model;
        try {
            // Switch model before sending if requested
            if (model) {
                activateChatGPT();
                selectModel(model);
            }
            activateChatGPT();
            sendPrompt(text);
            return [{ Status: 'Success' }];
        }
        catch (err) {
            throw new CommandExecutionError("Failed to send ChatGPT message: " + getErrorMessage(err));
        }
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Run on macOS with ChatGPT Desktop installed
  2. Use browser-based `chatgpt send`/`ask` on non-macOS platforms
  3. Route the call conditionally on process.platform in automation scripts

Example fix

// before
execSync(`opencli chatgpt-app send "${msg}"`);
// after
if (process.platform === 'darwin') execSync(`opencli chatgpt-app send "${msg}"`);
else execSync(`opencli chatgpt ask "${msg}"`);
Defensive patterns

Strategy: validation

Validate before calling

if (process.platform !== 'darwin') {
  throw new Error('chatgpt-app send requires macOS');
}
const MODEL_CHOICES = ['auto','instant','thinking','5.2-instant','5.2-thinking'];
if (model && !MODEL_CHOICES.includes(model)) throw new Error(`invalid model: ${model}`);

Type guard

const isMacOS = (): boolean => process.platform === 'darwin';

Try / catch

try {
  execSync(`opencli chatgpt-app send "${text}"`);
} catch (e) {
  if (String(e.message).includes('requires macOS')) {
    execSync(`opencli chatgpt ask "${text}"`); // cross-platform fallback
  } else throw e;
}

Prevention

When it happens

Trigger: Running `opencli chatgpt-app send "text"` (optionally with --model) on Linux or Windows; the platform guard throws before selectModel/activateChatGPT/sendPrompt.

Common situations: Automations/scheduled jobs on Linux servers; developers mixing up `chatgpt send` (browser) and `chatgpt-app send` (desktop).

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/a0f806fb8de22039. Report an issue: GitHub.