Install or update
Source: Notion | Last edited: 2025-04-26 | ID: 10c2d2dc-3ef...
2025-04-25 Updated:
Tested worked for both Ubuntu and Debian:
#!/usr/bin/env bash# ── Cursor IDE Installer ──# Copy & paste this entire block into your terminal and press Enter to install:
tmpfile=$(mktemp /tmp/cursor_installer.XXXXXX) || { echo "[ERROR] Failed to create temp file"; exit 1; }cat <<'INSTALLER' > "$tmpfile"#!/usr/bin/env bashset -euo pipefail
# Logging and error trapLOG_FILE="$HOME/.cursor_install.log"exec > >(tee -a "$LOG_FILE") 2>&1trap 'echo "[ERROR] Line $LINENO. See $LOG_FILE for details."; read -p "Press Enter to exit installer..."; exit 1' ERR
echo "[INFO] Starting Cursor IDE installation..."
# Tip for URLecho "[TIP] Find the latest AppImage URL at: • https://github.com/oslook/cursor-ai-downloads • https://www.cursor.com/downloads"read -rp "Enter the Cursor AppImage download URL: " DOWNLOAD_URL
# Validate URLif [[ ! "$DOWNLOAD_URL" =~ \.AppImage$ ]]; then echo "[ERROR] URL does not appear to end with .AppImage"; exit 1fi
APPIMAGE_NAME="${DOWNLOAD_URL##*/}"
# Directories and pathsAPP_DIR="$HOME/Applications"ICON_DIR="$HOME/.local/share/icons"DESKTOP_DIR="$HOME/.local/share/applications"BIN_DIR="$HOME/.local/bin"ICON_URL="https://www.cursor.com/brand/icon.svg"APPIMAGE_PATH="$APP_DIR/$APPIMAGE_NAME"ICON_PATH="$ICON_DIR/cursor-icon.svg"DESKTOP_FILE="$DESKTOP_DIR/cursor.desktop"LAUNCHER_SCRIPT="$BIN_DIR/cursor"
# Create directoriesmkdir -p "$APP_DIR" "$ICON_DIR" "$DESKTOP_DIR" "$BIN_DIR"
echo "[INFO] Installing dependencies (curl, fuse)..."if ! command -v curl &>/dev/null; then sudo apt-get update && sudo apt-get install -y curl; fiif ! command -v fusermount &>/dev/null && ! command -v fusermount3 &>/dev/null; then sudo apt-get update && sudo apt-get install -y fuse libfuse2; fi
echo "[INFO] Downloading AppImage to $APPIMAGE_PATH..."curl -fL "$DOWNLOAD_URL" -o "$APPIMAGE_PATH"chmod +x "$APPIMAGE_PATH"
# Verify download succeededif [ ! -f "$APPIMAGE_PATH" ]; then echo "[ERROR] Failed to download AppImage to $APPIMAGE_PATH"; exit 1fi
echo "[INFO] Downloaded AppImage as $APPIMAGE_PATH"
echo "[INFO] Downloading icon to $ICON_PATH..."if [ ! -f "$ICON_PATH" ]; then curl -fsSL "$ICON_URL" -o "$ICON_PATH"; fi
echo "[INFO] Writing desktop entry to $DESKTOP_FILE..."cat > "$DESKTOP_FILE" <<EOF[Desktop Entry]Name=Cursor IDEExec=$LAUNCHER_SCRIPT %FTerminal=falseType=ApplicationIcon=$ICON_PATHStartupWMClass=CursorComment=AI-first coding environmentCategories=Development;Utility;MimeType=application/x-executable;EOFchmod +x "$DESKTOP_FILE"
echo "[INFO] Creating launcher script at $LAUNCHER_SCRIPT..."cat <<LAUNCH > "$LAUNCHER_SCRIPT"#!/usr/bin/env bashexec "$APPIMAGE_PATH" --no-sandbox "\$@"LAUNCHchmod +x "$LAUNCHER_SCRIPT"
echo "[INFO] Updating desktop and icon caches..."update-desktop-database "$DESKTOP_DIR" 2>/dev/null || truegtk-update-icon-cache -f -t "$ICON_DIR" 2>/dev/null || true
# Ensure ~/.local/bin is in both bash and zsh configsfor rc in "$HOME/.bashrc" "$HOME/.zshrc"; do if ! grep -Fxq 'export PATH="$HOME/.local/bin:$PATH"' "$rc" 2>/dev/null; then echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$rc" fidoneexport PATH="$HOME/.local/bin:$PATH"
echo "[INFO] Installation complete! Open a new terminal and run 'cursor' to launch."INSTALLER
bash "$tmpfile"rm -f "$tmpfile"