Skip to content

Instantly share code, notes, and snippets.

@collinbarnwell
Created April 22, 2025 22:38
Show Gist options
  • Save collinbarnwell/27ff146fc3e0faabd08ff4f3a7e102a1 to your computer and use it in GitHub Desktop.
Save collinbarnwell/27ff146fc3e0faabd08ff4f3a7e102a1 to your computer and use it in GitHub Desktop.
Cursor Install + Update Script for Linux
#!/bin/bash
#
# To install cursor, put this script in ~/cursor or (or anywhere else, just update APPDIR accordingly).
#
# Run this script `bash ~/cursor/update-cursor.sh`
#
# Create a simlink
#
# `sudo ln -s ~/cursor/cursor.AppImage /usr/local/bin/cursor`
#
# Now to start cursor anywhere, you can run `cursor . --no-sandbox` and run `bash ~/cursor/update-cursor.sh` to update.
#
APPDIR=~/cursor
API_URL="https://www.cursor.com/api/download?platform=linux-x64&releaseTrack=stable"
CURRENT_VERSION_FILE="$APPDIR/.cursor_version"
# Create directory if it doesn't exist
mkdir -p "$APPDIR"
# Get the latest version info from the API
LATEST_INFO=$(curl -s "$API_URL")
LATEST_URL=$(echo "$LATEST_INFO" | grep -o '"downloadUrl":"[^"]*"' | cut -d'"' -f4)
LATEST_VERSION=$(echo "$LATEST_INFO" | grep -o '"version":"[^"]*"' | cut -d'"' -f4)
# Check if we have a current version file
if [ -f "$CURRENT_VERSION_FILE" ]; then
CURRENT_VERSION=$(cat "$CURRENT_VERSION_FILE")
if [ "$CURRENT_VERSION" = "$LATEST_VERSION" ]; then
echo "Cursor is already up to date (version $CURRENT_VERSION)"
exit 0
fi
fi
echo "Downloading Cursor version $LATEST_VERSION..."
wget -O "$APPDIR/cursor.AppImage" "$LATEST_URL"
chmod +x "$APPDIR/cursor.AppImage"
# Save the new version
echo "$LATEST_VERSION" >"$CURRENT_VERSION_FILE"
echo "Update complete!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment