Automating Cursor Updates on Linux: A Bash Script Solution
This script has saved me countless hours of manual updates and ensures that I am running latest version of Cursor.
Feel free to modify the script to suit your specific needs, and let me know if you have any improvements or suggestions!ss
As a someone who uses Cursor daily, I found myself manually downloading and updating the application whenever new versions were released. This could me a few times a day. It was super tedious, so I created a comprehensive bash script that automates the entire process. In this post, I’ll walk you through the script and explain how it works.
The Problem
Cursor releases frequent updates (sometimes may times a day), and AUR is slow to update. So I needed a solution that would:
- Check for the latest version automatically
- Download and install updates seamlessly
- Integrate with the desktop environment
- Provide command-line access
- Handle version checking to avoid unnecessary downloads
The Solution: A Comprehensive Update Script
Here’s the complete script that solves all these problems:
You can view, copy, or download the complete script as a GitHub Gist here: auto-update-cursor.sh
Key Features
1. Smart Version Checking
The script uses Cursor’s API to fetch the latest version information and compares it with the currently installed version. This prevents unnecessary downloads when you’re already up to date.
2. Force Update Option
Sometimes you might want to reinstall even if you have the latest version. The -f or --force flag allows you to bypass version checking.
3. Desktop Integration
The script automatically:
- Downloads and sets up the icon
- Creates a desktop entry for the application menu
4. Command Line Access
After installation, you can launch Cursor from the terminal using the cursor command. The script creates a wrapper in ~/bin/cursor that launches the AppImage. (make sure you have ~/bin in your $PATH)
Usage
Basic Usage
# Make the script executable
chmod +x update-cursor.sh
# Run the update
./update-cursor.sh
Force Update
# Force update even if latest version is installed
./update-cursor.sh --force
Help
# Show usage information
./update-cursor.sh --help
Prerequisites
The script requires two common Linux tools:
curl- for downloading filesjq- for parsing JSON responses
Install them on your system:
Ubuntu/Debian:
sudo apt update
sudo apt install curl jq
Omarchy:
sudo yay -S curl jq
How It Works
- API Query: The script queries Cursor’s download API to get the latest version information
- Version Comparison: It compares the latest version with the currently installed version
- Download: If an update is needed (or forced), it downloads the latest AppImage
- Installation: The script replaces the old AppImage with the new one
- Integration: It updates the desktop entry and creates command-line access
- Cleanup: Temporary files are removed
Customization
You can easily customize the script by modifying these variables at the top:
INSTALL_DIR="$HOME/opt" # Change installation directory
APP_NAME="Cursor" # Change application name
Automation
To make this even more convenient, you can set up a cron job to run the script automatically:
# Add to crontab to check for updates daily at 9 AM
0 9 * * * /path/to/update-cursor.sh
Or create a systemd timer for more sophisticated scheduling.