blob: fb9ca2c31a3d567e5d3410ebd6dcd9e24d4770c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
#!/usr/bin/env bash
# Color support: check NO_COLOR or non-TTY (stdout)
if [ -n "${NO_COLOR+x}" ] || [ ! -t 1 ]; then
CYAN=''
GREEN=''
YELLOW=''
BLUE=''
PURPLE=''
RED=''
BOLD=''
DIM=''
NC=''
else
CYAN='\033[0;36m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
RED='\033[0;31m'
BOLD='\033[1m'
DIM='\033[2m'
NC='\033[0m'
fi
# Fancy header
echo ""
echo -e "${BOLD}Cursor Agent Installer${NC}"
echo ""
# Function to print steps with style
print_step() {
echo -e "${BLUE}▸${NC} ${1}"
}
# Function to print success
print_success() {
# Move cursor up one line and clear it
echo -ne "\033[1A\033[2K"
echo -e "${GREEN}✓${NC} ${1}"
}
# Function to print error
print_error() {
echo -e "${RED}✗${NC} ${1}"
}
# Detect OS and Architecture
print_step "Detecting system architecture..."
# Detect OS
OS="$(uname -s)"
case "${OS}" in
Linux*) OS="linux";;
Darwin*) OS="darwin";;
*)
print_error "Unsupported operating system: ${OS}"
exit 1
;;
esac
# Detect Architecture
ARCH="$(uname -m)"
case "${ARCH}" in
x86_64|amd64) ARCH="x64";;
arm64|aarch64) ARCH="arm64";;
*)
print_error "Unsupported architecture: ${ARCH}"
exit 1
;;
esac
print_success "Detected ${OS}/${ARCH}"
# Installation steps
print_step "Creating installation directory..."
# Create temporary directory for atomic download inside versions folder
TEMP_EXTRACT_DIR="$HOME/.local/share/cursor-agent/versions/.tmp-2026.05.27-fe9a6e2-$(date +%s)"
mkdir -p "${TEMP_EXTRACT_DIR}"
print_success "Directory created"
print_step "Downloading Cursor Agent package..."
DOWNLOAD_URL="https://downloads.cursor.com/lab/2026.05.27-fe9a6e2/${OS}/${ARCH}/agent-cli-package.tar.gz"
echo -e "${DIM} Download URL: ${DOWNLOAD_URL}${NC}"
# Cleanup function
cleanup() {
command rm -rf "${TEMP_EXTRACT_DIR}"
}
trap cleanup EXIT
# Download with progress bar and better error handling
if curl -fSL --progress-bar "${DOWNLOAD_URL}" \
| tar --strip-components=1 -xzf - -C "${TEMP_EXTRACT_DIR}"; then
echo -ne "\033[1A\033[2K"
echo -ne "\033[1A\033[2K"
echo -ne "\033[1A\033[2K"
print_success "Package downloaded and extracted"
else
print_error "Download failed. Please check your internet connection and try again."
print_error "If the problem persists, the package might not be available for ${OS}/${ARCH}."
cleanup
exit 1
fi
print_step "Finalizing installation..."
# Atomically move from temp to final destination
FINAL_DIR="$HOME/.local/share/cursor-agent/versions/2026.05.27-fe9a6e2"
command rm -rf "${FINAL_DIR}"
if mv "${TEMP_EXTRACT_DIR}" "${FINAL_DIR}"; then
print_success "Package installed successfully"
else
print_error "Failed to install package. Please check permissions."
cleanup
exit 1
fi
print_step "Creating bin directory..."
mkdir -p ~/.local/bin
print_success "Bin directory ready"
print_step "Creating symlinks to agent executable..."
# Remove any existing symlink or file
command rm -f ~/.local/bin/cursor-agent
# Create symlinks to the Cursor Agent executable
ln -s ~/.local/share/cursor-agent/versions/2026.05.27-fe9a6e2/cursor-agent ~/.local/bin/cursor-agent
print_success "Symlink created"
# Success message
echo ""
echo -e "${BOLD}${GREEN}✨ Installation Complete! ${NC}"
echo ""
echo ""
# Check if ~/.local/bin is already in PATH
if [[ ":${PATH}:" == *":${HOME}/.local/bin:"* ]]; then
# PATH already configured, just show usage
echo -e "${BOLD}Start using Cursor Agent:${NC}"
echo -e " ${BOLD}cursor-agent${NC}"
else
echo -e "${BOLD}Add ~/.local/bin to PATH:${NC}"
fi
echo ""
echo ""
echo -e "${BOLD}${CYAN}Happy coding! 🚀${NC}"
echo ""
|