/Applications/Cursor.app/Contents/Resources/app/bin/code in previous version:
#!/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.
# 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
"$REMOTE_CLI" "$@"
exit $?
fi
fi
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}}"
}
APP_PATH="$(app_realpath "${BASH_SOURCE[0]}")"
if [ -z "$APP_PATH" ]; then
echo "Unable to determine app path from symlink : ${BASH_SOURCE[0]}"
exit 1
fi
CONTENTS="$APP_PATH/Contents"
ELECTRON="$CONTENTS/MacOS/Cursor"
CLI="$CONTENTS/Resources/app/out/cli.js"
export VSCODE_NODE_OPTIONS=$NODE_OPTIONS
export VSCODE_NODE_REPL_EXTERNAL_MODULE=$NODE_REPL_EXTERNAL_MODULE
unset NODE_OPTIONS
unset NODE_REPL_EXTERNAL_MODULE
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"
exit $?
/Applications/Cursor.app/Contents/Resources/app/bin/code in 1.6.x:
#!/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 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
# If cursor-agent exists, try to find CURSOR_CLI but don't fail if we can't
if find_cursor_cli 2>/dev/null; then
# Export both variables if we found them
if [ -n "$CURSOR_CLI" ]; then
export CURSOR_CLI
export CURSOR_CLI_MODE
fi
fi
if ! command -v 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
tput cuu1 && tput el
fi
export CURSOR_CLI_COMPAT=1
exec ~/.local/bin/cursor-agent "$@"
Doing a echo hello | cursor - does not open cursor editor with text anymore. This was working till last update. Even cursor --version does not print anything
Steps to Reproduce
echo hello | cursor -
Expected Behavior
Open Cursor with temporary file containing hello
Operating System
MacOS
Current Cursor Version (Menu → About Cursor → Copy)
If you look at the new one, this has maliciously and sneakily run curl -sS https://cursor.com/install | bash >/dev/null 2>&1 without asking.
WHAT THE HELL!!
I don’t want cursor-agent to be force installed on my machine. This makes it completely unacceptable on my corporate machine! Directly pulling a bash script and force running it with my user permissions is unacceptable.
For folks who don’t want to install cursor agent, set CURSOR_CLI_BLOCK_CURSOR_AGENT=true.
You’ll still get No such file or directory, and Cursor will still try to install cursor-agent, but at least the cli command will work.
Re: Cursor team, suggestions/code review:
Allow any values for CURSOR_CLI_BLOCK_CURSOR_AGENT, that’s the common in idiom in bash.
Cursor-agent shouldn’t be installed if the block is on. You’re missing an exit 0 after evaling the cli.
We want to use the cursor CLI to connect to a remove server. By setting the CURSOR_CLI_BLOCK_CURSOR_AGENT env, I expected it to actually “block” the of cursor-agent. But it doesn’t stop at launching IDE and still launches cursor-agent.
Steps to Reproduce
Fresh install cursor, and add the cursor executable in the PATH
run export CURSOR_CLI_BLOCK_CURSOR_AGENT=true and cursor
Expected Behavior
Only IDE GUI is launched.
Operating System
MacOS
Current Cursor Version (Menu → About Cursor → Copy)
i also got issue when i try to run cursor via my terminal appear like this
cursor-agent not found, installing via https://cursor.com/install ...
then
/usr/local/bin/cursor: line 112: /Users/<username>/.local/bin/cursor-agent: No such file or directory
/usr/local/bin/cursor: line 112: exec: /Users/<username>/.local/bin/cursor-agent: cannot execute: No such file or directory