Cursor CLI hangs with user permissions

Where does the bug appear (feature/product)?

Cursor CLI

Describe the Bug

CLI just hangs if I don’t provide root permissions to the cli. I still think that it handles the input during the launch but it shows nothing in the terminal. After launching with sudo it works perfectly.
Also after terminating the script using ctrl + c, it prints what it should have shown after the launch. Check the screenshots

Steps to Reproduce

Just launch using agent script

Expected Behavior

It should work without providing root permissions

Screenshots / Screen Recordings

Operating System

MacOS

Version Information

CLI Version 2026.03.11-6dfa30c

Does this stop you from using Cursor

Yes - Cursor is unusable

Hi @Dmitrii_Viatkin,

Thanks for the detailed report and the recording. The behavior you’re seeing – blank terminal, then the “Workspace Trust Required” dialog appearing after Ctrl+C – tells us the process is alive, but something is blocking before the TUI can render.

This is a known class of CLI startup issues on macOS. A few things could be causing it, and I have some quick tests that will help narrow it down.

1. Try running with a clean HOME directory

This bypasses keychain and config file access, which is one of the likeliest hang points:

HOME=/tmp agent

If this works, the issue is related to keychain access or a config file in your ~/.cursor/ directory.

2. Try removing the --use-system-ca flag from the launcher

This flag has caused issues for other macOS users. Find the launcher script (usually at ~/.local/bin/cursor-agent) and look for the last line:

exec -a "$0" "$NODE_BIN" --use-system-ca "$SCRIPT_DIR/index.js" "$@"

Change it to:

exec -a "$0" "$NODE_BIN" "$SCRIPT_DIR/index.js" "$@"

Then run agent again without sudo. This edit will be overwritten on the next update, but it helps isolate the cause.

3. Which terminal emulator are you using?

Terminal.app, iTerm2, Warp, or something else? There are known interactions between certain terminals and the CLI on macOS.

4. Do you have any MCP servers configured?

cat ~/.cursor/mcp.json 2>/dev/null || echo "No MCP config found"

Let me know the results of these tests and I can dig in further.

Hi Mohit,

  1. Didn’t work
  2. also didn’t work. I even combined this two approaches together, also it didn’t work
  3. tried in Terminal, ghostty, warp
  4. nope, I don’t use any

Thanks in advance

The most likely remaining explanation: sudo on macOS strips environment variables (via env_reset in sudoers). If you have proxy-related env vars set, the CLI hangs on startup trying to route through them.

1. Check for proxy env vars:

env | grep -iE 'proxy|agent|http_|https_|all_|no_'

2. Try running with a clean environment (simulates what sudo does):

env -i HOME="$HOME" PATH="/usr/bin:/bin:/usr/local/bin:$HOME/.local/bin" TERM="$TERM" agent

If that works, an env var is the cause and we can narrow down which one.

3. If that also hangs, get a process sample:

agent &
AGENT_PID=$!
sleep 5
sample $AGENT_PID 3 -file /tmp/agent-sample.txt
kill $AGENT_PID

Share /tmp/agent-sample.txt and it’ll show exactly where it’s stuck.

Actually this works, I mean command with env, I will check then env that I have currently

Do you need an actual content of the $PATH variable that I currently have?

Not PATH – that wouldn’t cause a hang. Run this from step 1:

env | grep -iE 'proxy|agent|http_|https_|all_|no_'

Paste whatever it outputs. The CLI picks up proxy environment variables at startup, and if one points to an unreachable proxy, it hangs on every network request. That’s almost certainly what env -i is bypassing.

If that returns nothing, run env by itself and share the full output (redact anything sensitive).

env output (with grep it printed nothing) + changed my user name

MANPATH=/Users/<MY_USER>/.nvm/versions/node/v18.20.7/share/man::/usr/share/man:/usr/local/share/man:/Applications/Ghostty.app/Contents/Resources/ghostty/../man:
GHOSTTY_RESOURCES_DIR=/Applications/Ghostty.app/Contents/Resources/ghostty
TERM_PROGRAM=ghostty
TERM=xterm-ghostty
SHELL=/bin/zsh
TMPDIR=/var/folders/xt/n5_kcj111wj5k5gd4tsq08zw0000gp/T/
TERM_PROGRAM_VERSION=1.2.3
USER=<MY_USER>
COMMAND_MODE=unix2003
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.j4xJIIMRaT/Listeners
__CF_USER_TEXT_ENCODING=0x0:0:0
PATH=/Users/<MY_USER>/.opencode/bin:/Users/<MY_USER>/.nvm/versions/node/v18.20.7/bin:/Users/<MY_USER>/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/usr/local/go/bin:/Applications/Ghostty.app/Contents/MacOS:/Users/<MY_USER>/Library/Application Support/JetBrains/Toolbox/scripts:/Users/<MY_USER>/maven/bin:/Users/<MY_USER>/Library/Java/JavaVirtualMachines/corretto-17.0.16/Contents/Home:/Users/<MY_USER>/mvnd/bin
GHOSTTY_SHELL_FEATURES=cursor,path,title
LaunchInstanceID=E7E2E1CB-D1D2-4B57-B59C-7BF73C896160
__CFBundleIdentifier=com.mitchellh.ghostty
PWD=/Users/<MY_USER>/cursor-cli/
LANG=en_US.UTF-8
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
SHLVL=1
HOME=/Users/<MY_USER>
TERMINFO=/Applications/Ghostty.app/Contents/Resources/terminfo
LOGNAME=<MY_USER>
XDG_DATA_DIRS=/usr/local/share:/usr/share:/Applications/Ghostty.app/Contents/Resources/ghostty/..
GHOSTTY_BIN_DIR=/Applications/Ghostty.app/Contents/MacOS
OSLogRateLimit=64
SECURITYSESSIONID=186ba
COLORTERM=truecolor
OLDPWD=/Users/<MY_USER>/cursor-cli/
HOMEBREW_PREFIX=/opt/homebrew
HOMEBREW_CELLAR=/opt/homebrew/Cellar
HOMEBREW_REPOSITORY=/opt/homebrew
INFOPATH=/opt/homebrew/share/info:
NVM_DIR=/Users/<MY_USER>/.nvm
NVM_CD_FLAGS=-q
NVM_BIN=/Users/<MY_USER>/.nvm/versions/node/v18.20.7/bin
NVM_INC=/Users/<MY_USER>/.nvm/versions/node/v18.20.7/include/node
JAVA_HOME=/Users/<MY_USER>/Library/Java/JavaVirtualMachines/corretto-17.0.16/Contents/Home
MAVEN_HOME=/Users/<MY_USER>/maven/bin
CI=true
MVND_HOME=/Users/<MY_USER>/mvnd/bin
_=/usr/bin/env

Thanks for sharing the full env output. No proxy variables are present, so that hypothesis is ruled out.

Before the bisection: can you run this first?

type agent

If it shows a shell function or alias (rather than just a file path), that’s likely the cause – the function could be injecting variables that env doesn’t show but the CLI receives at runtime.

If type agent shows a plain file path, move to bisection:

Step 1 – test if it’s the PATH:

env -i HOME="$HOME" PATH="$PATH" TERM="$TERM" agent

This uses your full PATH but strips everything else.

Step 2 (if step 1 works) – test the suspicious group:

env -i HOME="$HOME" PATH="$PATH" TERM="$TERM" CI=true SSH_AUTH_SOCK="$SSH_AUTH_SOCK" NVM_DIR="$NVM_DIR" NVM_BIN="$NVM_BIN" agent

Step 3 (if step 2 works) – test the rest:

env -i HOME="$HOME" PATH="$PATH" TERM="$TERM" SHELL="$SHELL" LANG="$LANG" COLORTERM="$COLORTERM" JAVA_HOME="$JAVA_HOME" HOMEBREW_PREFIX="$HOMEBREW_PREFIX" XDG_DATA_DIRS="$XDG_DATA_DIRS" agent

Whichever step first reproduces the hang contains the offending variable. Let me know which step hangs and we’ll isolate it from there.

Also: CI=true in your env is unusual for an interactive shell. Where does it come from? (It shouldn’t cause the hang here, but it can affect other tools.)