Control the ChatGPT macOS Desktop App directly from the terminal. OpenCLI supports two automation approaches for ChatGPT.
The current built-in commands use native AppleScript automation — no extra launch flags needed.
- Install the official ChatGPT Desktop App from OpenAI.
- Grant Accessibility permissions to your terminal app in System Settings → Privacy & Security → Accessibility.
opencli chatgpt status: Check if the ChatGPT app is currently running.opencli chatgpt new: Activate ChatGPT and pressCmd+Nto start a new conversation.opencli chatgpt send "message": Copy your message to clipboard, activate ChatGPT, paste, and submit.opencli chatgpt read: Copy the last AI response viaCmd+Shift+Cand return it as text.
ChatGPT Desktop is also an Electron app and can be launched with a remote debugging port:
/Applications/ChatGPT.app/Contents/MacOS/ChatGPT \
--remote-debugging-port=9224export OPENCLI_CDP_ENDPOINT="http://127.0.0.1:9224"The CDP approach enables future advanced commands like DOM inspection, model switching, and code extraction.
- AppleScript mode: Uses
osascriptandpbcopy/pbpastefor clipboard-based text transfer. - CDP mode: Connects via Chrome DevTools Protocol to the Electron renderer process.
- macOS only (AppleScript dependency)
- AppleScript mode requires Accessibility permissions
readcommand copies the last response — earlier messages need manual scroll