Cursor cannot be launched from the terminal via command line

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

After opening the terminal and goes into the project repository directory, running cursor . results in the following error:

/usr/local/bin/cursor: line 20: 33419 Killed: 9
ELECTRON_RUN_AS_NODE=1 “/Applications/Cursor.app/Contents/MacOS/Cursor” “/Applications/Cursor.app/Contents/Resources/app/out/cli.js” .

Initially, Cursor showed no response and failed to launch. After some time, Cursor started opening, but it did not open the current working directory correctly.

I have already tried the following troubleshooting steps, but the issue persists:

  1. Reinstalling Cursor
  2. Uninstalling and re-installing the Cursor command-line tool
  3. Deleting Cursor’s cache and configuration files
  4. Restarting the computer

Steps to Reproduce

  1. open project directory and type: cursor .
  2. Cursor not responese and return an Error: /usr/local/bin/cursor: line 20: 26654 Killed: 9 ELECTRON_RUN_AS_NODE=1 “/Applications/Cursor.app/Contents/MacOS/Cursor” “/Applications/Cursor.app/Contents/Resources/app/out/cli.js” .

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.1.42
VSCode Version: 1.105.1
Commit: 2e353c5f5b30150ff7b874dee5a87660693d9de0
Date: 2025-12-01T02:18:26.377Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 24.6.0

Does this stop you from using Cursor

Yes - Cursor is unusable

Hey, thanks for the report. Let’s quickly check the shell command installation and paths:

  1. In Cursor, open the palette (CMD+Shift+P) → Shell Command: Install “cursor” command in PATH, then restart the terminal and try cursor.

If that doesn’t help, please send:

  • Exact macOS version (System Settings → About This Mac).
  • Output of commands:
  • which cursor
  • ls -l /usr/local/bin/cursor
  • cat /usr/local/bin/cursor
  • Try running directly (bypasses wrapper) and attach output/error:
  • “/Applications/Cursor.app/Contents/MacOS/Cursor” .
  • Any error logs from Console.app (time around “Killed: 9”).

If the problem persists after reinstalling the shell command, we’ll escalate to engineering.

Thanks for the detailed report! “Killed: 9” means macOS is forcibly stopping the process - let’s figure out why.

A few quick checks:

  1. Does Cursor open normally when you double-click the app from Applications?
  2. Run this in Terminal and share the output:
codesign -vvv /Applications/Cursor.app
  1. Open Console.app, filter for “Cursor” or “kernel”, then run cursor . and share any messages that appear

This will help us determine if it’s an issue with 2.1.42 build or something specific to your system. Let me know what you find!

same problem

  1. Cursor open normally when double-click app icon

  2. output:
    –prepared:/Applications/Cursor.app/Contents/Frameworks/Cursor Helper.app
    –validated:/Applications/Cursor.app/Contents/Frameworks/Cursor Helper.app
    –prepared:/Applications/Cursor.app/Contents/Frameworks/ReactiveObjC.framework/Versions/Current/.
    –validated:/Applications/Cursor.app/Contents/Frameworks/ReactiveObjC.framework/Versions/Current/.
    –prepared:/Applications/Cursor.app/Contents/Frameworks/Squirrel.framework/Versions/Current/.
    –validated:/Applications/Cursor.app/Contents/Frameworks/Squirrel.framework/Versions/Current/.
    –prepared:/Applications/Cursor.app/Contents/Frameworks/Mantle.framework/Versions/Current/.
    –validated:/Applications/Cursor.app/Contents/Frameworks/Mantle.framework/Versions/Current/.
    –prepared:/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/Current/.
    –validated:/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/Current/.
    –prepared:/Applications/Cursor.app/Contents/Frameworks/Cursor Helper (Renderer).app
    –validated:/Applications/Cursor.app/Contents/Frameworks/Cursor Helper (Renderer).app
    –prepared:/Applications/Cursor.app/Contents/Frameworks/Cursor Helper (GPU).app
    –validated:/Applications/Cursor.app/Contents/Frameworks/Cursor Helper (GPU).app
    –prepared:/Applications/Cursor.app/Contents/Frameworks/Cursor Helper (Plugin).app
    –validated:/Applications/Cursor.app/Contents/Frameworks/Cursor Helper (Plugin).app
    /Applications/Cursor.app: valid on disk
    /Applications/Cursor.app: satisfies its Designated Requirement

  3. messages are always present, Here are part of it:

1 Like

Here are some error occured when cursor . through Console.app

Thanks for the screenshot! Those “main thread” warnings are routine and not the cause of the kill. To find the actual reason, could you:

  1. In Console.app, filter by “kernel” or “AMFI” right when you run cursor . that should show why macOS killed the process
  2. Share the output of the commands from the earlier reply: which cursor, ls -l /usr/local/bin/cursor, and cat /usr/local/bin/cursor
  3. Do you have any security software, antivirus, or corporate MDM installed?

This will help us pinpoint why macOS is blocking the CLI launch. Thanks!

Thank u for your reply,

  1. I v retry a lot of times, and find another error showed in Console, which seems different from many others:
    `Sandbox: logd_helper(376) deny(1) file-read-data /Applications/Cursor.app/Contents/Resources/app/extensions/cursor-retrieval/node_modules/@anysphere/file-service/file_service.darwin-universal.node`

  2. macOS info: 15.7.2 (24G325)

  3. which cursor outputs: /usr/local/bin/cursor

  4. ls -l /usr/local/bin/cursor returns lrwxr-xr-x@ 1 mac wheel 56 12 1 18:10 /usr/local/bin/cursor -> /Applications/Cursor.app/Contents/Resources/app/bin/code

  5. cat:

#!/usr/bin/env bash
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.

function app_realpath() {
	SOURCE=$1
	while [ -h "$SOURCE" ]; do
		DIR=$(dirname "$SOURCE")
		SOURCE=$(readlink "$SOURCE")
		[[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE
	done
	SOURCE_DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
	echo "${SOURCE_DIR%%${SOURCE_DIR#*.app}}"
}

function use_cursor_cli() {
	if [ -n "$CURSOR_CLI" ]; then
		# Use the CLI found by find_cursor_cli
		eval "$CURSOR_CLI" "$@"
		exit $?
	else
		echo "Error: Cursor CLI not found. Please install Cursor properly." 1>&2
		exit 1
	fi
}

function find_cursor_cli() {
	# Clear the output variables
	CURSOR_CLI=""
	CURSOR_CLI_MODE=""

	# when run in remote terminal, use the remote cli
	if [ -n "$VSCODE_IPC_HOOK_CLI" ]; then
		REMOTE_CLI="$(which -a 'cursor' | grep /remote-cli/)"
		if [ -n "$REMOTE_CLI" ]; then
			CURSOR_CLI="$REMOTE_CLI"
			CURSOR_CLI_MODE="remote"
			return 0
		fi
	fi

	# Otherwise, use the electron app
	APP_PATH="$(app_realpath "${BASH_SOURCE[0]}")"
	if [ -z "$APP_PATH" ]; then
		echo "Unable to determine app path from symlink : ${BASH_SOURCE[0]}" >&2
		return 1
	fi
	CONTENTS="$APP_PATH/Contents"
	ELECTRON="$CONTENTS/MacOS/Cursor"
	CLI="$CONTENTS/Resources/app/out/cli.js"
	CURSOR_CLI="ELECTRON_RUN_AS_NODE=1 \"$ELECTRON\" \"$CLI\""
	CURSOR_CLI_MODE="local"
	return 0
}

# Main execution
export VSCODE_NODE_OPTIONS=$NODE_OPTIONS
export VSCODE_NODE_REPL_EXTERNAL_MODULE=$NODE_REPL_EXTERNAL_MODULE
unset NODE_OPTIONS
unset NODE_REPL_EXTERNAL_MODULE

# Check if cursor-agent is blocked but user is trying to use it
if [ "$1" = "agent" ] && [ "$CURSOR_CLI_BLOCK_CURSOR_AGENT" = "true" ]; then
	echo "cursor-agent is blocked in your environment due to the CURSOR_CLI_BLOCK_CURSOR_AGENT environment variable" 1>&2
	echo "Please remove the block to use cursor-agent command." 1>&2
	exit 1
fi

if ! find_cursor_cli && [ "$1" != "agent" ]; then
	echo "Error: Cursor CLI not found. Please install Cursor properly." 1>&2
	exit 1
fi

# Export variables for compatibility
# These variables are needed even in cursor-agent, to know that we are routing from 'cursor' command
if [ -n "$CURSOR_CLI" ]; then
	export CURSOR_CLI
	export CURSOR_CLI_MODE
fi


# Simplified routing logic
if [ "$1" = "editor" ]; then
	# Route to Cursor CLI, removing the 'editor' argument
	# cursor editor is equivalent to cursor, just explicitly stating that
	# editor is being used (instead of agent being used)
	shift
	use_cursor_cli "$@"
elif [ "$1" = "agent" ] && [ "$CURSOR_CLI_BLOCK_CURSOR_AGENT" != "true" ]; then
	# Route to cursor-agent
	if ! command -v ~/.local/bin/cursor-agent >/dev/null 2>&1; then
		echo "cursor-agent not found, installing via https://cursor.com/install ..."
		curl -sS https://cursor.com/install | bash >/dev/null 2>&1
		# Remove the previous log line from the terminal output
		if command -v tput >/dev/null 2>&1; then
			tput cuu1 && tput el
		fi
		# Check if installation succeeded
		if ! command -v ~/.local/bin/cursor-agent >/dev/null 2>&1; then
			echo "Error: Could not install cursor-agent." 1>&2
			echo "Please install manually by running 'curl -sS https://cursor.com/install | bash >/dev/null'" 1>&2
			echo "" 1>&2
			echo "To open IDE, use 'cursor' or 'cursor editor' command." 1>&2
			exit 1
		fi
	fi

	# Check current cursor-agent version meets minimum version requirement
	OUTPUT=$({ ~/.local/bin/cursor-agent --min-version=2025.10.01 status; } 2>&1)
	EXIT_CODE=$?

	# Update and retry if version is too old or doesn't support --min-version
	if { [ "$EXIT_CODE" -eq 2 ] || { [ "$EXIT_CODE" -eq 1 ] && echo "$OUTPUT" | grep -qi "unknown option"; }; }; then
		echo "cursor-agent version is outdated, updating..."
		~/.local/bin/cursor-agent update >/dev/null 2>&1
		# Remove the previous log line from the terminal output
		if command -v tput >/dev/null 2>&1; then
			tput cuu1 && tput el
		fi
		# Check new version to see if minimum version requirement is met
		OUTPUT2=$({ ~/.local/bin/cursor-agent --min-version=2025.10.01 status; } 2>&1)
		EXIT_CODE2=$?
		if { [ "$EXIT_CODE2" -eq 2 ] || { [ "$EXIT_CODE2" -eq 1 ] && echo "$OUTPUT2" | grep -qi "unknown option"; }; }; then
			echo "Error: cursor-agent version is too old. Please update with 'cursor-agent update'" 1>&2
			exit 1
		fi
	fi

	# Version is sufficient, run cursor-agent
	export CURSOR_CLI_COMPAT=1
	exec ~/.local/bin/cursor-agent "$@"
else
	# Route to Cursor CLI
	use_cursor_cli "$@"
fi

same problem