Cursor CLI just quits with exit code 1 and no output on macOS VM in CI

Where does the bug appear (feature/product)?

Cursor CLI

Describe the Bug

I’ve tried to run the Cursor CLI on the macOS VM that is used as a Jenkins executor, and I’ve run into a weird issue: agent installs without problems, I can run commands like agent --version and their return the output, but if I try to run agent -p <prompt> or just agent, CLI just quits, outputs nothing and I see that the exit code is 1.

This happens when I try to use agent in a Jenkins job, and it happens when I connect to the VM through SSH and try to use agent manually.

What’s weird is that if I connect to the VM through VNC and launch Terminal.app in a GUI environment, then the agent works.

I though this is the GUI layer issue, as launchctl managername returns Background for SSH, but I tested that on a normal MBP, and agent works through SSH on it.

Any idea how to fix this OR how to debug it further to give you guys more information?

Steps to Reproduce

  1. Install Cursor CLI on macOS VM
  2. Use this VM as an executor on Jenkins
  3. Try to run agent or agent -p <prompt>

Operating System

MacOS

Version Information

2026.01.28-fd13201

Does this stop you from using Cursor

Yes - Cursor is unusable

1 Like

Hey, thanks for the detailed report.

The difference between the GUI terminal and SSH on a macOS VM is most likely due to how auth credentials are stored. On macOS, agent login usually saves tokens in Keychain, which requires the graphical security agent. That isn’t available in SSH or background sessions on a VM, unlike a regular Mac with an always-on GUI user session.

A couple things to try:

  1. Use API key auth instead of browser login. This fully bypasses Keychain. Generate a key in your Cursor dashboard (Integrations > User API Keys), then run:

    export CURSOR_API_KEY=your_key_here
    agent -p "test prompt"
    

    Docs: Authentication | Cursor Docs

  2. Check what agent status shows when running over SSH. That should tell us whether it’s an auth issue or something else.

If the API key approach works over SSH, that would confirm the issue is Keychain access. Let me know how it goes.

I forgot to mention - yes, I use the API key.

I can see the key in the env when I do echo $CURSOR_API_KEY, but agent status returns:
Not logged in

BUT it also returns Not logged in when I launch the agent in the GUI environment, but it is definitely authorized and works, cause I can run prompts with for example GPT-5.3 Codex. I haven’t logged in via a web browser there, this is a fresh VM on every start, and I do the fresh install of the Cursor CLI there every time.

In 2026.02.13-41ac335 I now get this error:
Error: Security command failed: Security process exited with code: 36