Version 2.1.2 - Cursor 2.x Compatibility & Detection Fixes
This repository contains the bash script cursor-setup-ubuntu, inspired by the cursor-setup-wizard repository. This script automatically downloads and installs the latest version of the Cursor AI AppImage on Ubuntu and its derivatives. Cursor AI is a powerful AI-assisted code editor, available at cursor.com.
- โ Cursor 2.x Support: Full compatibility with Cursor 2.0.11 and newer 2.x versions
- ๐ Fixed Version Detection: Resolved automatic version check failures from cursor-ai-downloads repository
- ๐ Fixed Installation Detection: Script now properly detects installed Cursor AppImages (glob pattern fix)
- โก Improved Network Resilience: More flexible connectivity checks with fallback to Google DNS (8.8.8.8)
- ๐ Better Timeout Handling: Increased curl timeout from 5s to 10s for slow or unstable connections
- ๐ก๏ธ Enhanced Content Validation: Validates downloaded repository content size (minimum 1KB) before processing
- ๐ Enhanced Debug Mode: Extensive debug logging available with
DEBUG_MODE=truefor troubleshooting - ๐ง Fixed Pattern Expansion: Removed quotes from glob patterns to allow proper shell expansion in file detection
- ๐ Critical Security Fixes: Fixed unsafe variable expansion and dangerous eval usage
- ๐ก๏ธ Enhanced Input Validation: Comprehensive version checking and security validation
- ๐ Critical Bug Fixes: Fixed "target is empty" wrapper script bug (GitHub issue #1)
- ๐ Standardized Exit Codes: Named constants for better error handling
- โก Optimized Performance: Improved process detection and atomic operations
- ๐ง Code Quality: Extracted magic numbers to named configuration constants
- ๐ Automatic Language Detection: Smart detection of system language (English/Spanish)
- ๐ง Enhanced Configuration: Extensive environment variable support
- ๐ System Information: New menu option to display detected settings
- ๐จ Improved Logging: Colored output with timestamps and debug levels
- โก Better Performance: Optimized functions and cleaner code architecture
The cursor-setup-ubuntu script automates the installation, updating, and management of the Cursor AI AppImage on Ubuntu-based systems. It provides the following functionalities:
- Automated Installation & Updates: Automatically downloads and installs the latest version of Cursor AI.
- Automatic Downloads: Downloads the latest version directly from the cursor-ai-downloads repository without manual intervention.
- Architecture Detection: Automatically detects and downloads the appropriate AppImage for your system (x64 or ARM64).
- Version Comparison: Checks for the latest version and prompts for an update if necessary.
- Desktop Integration: Creates or updates a desktop shortcut with an application icon.
- Executable Symlink Creation: Allows launching Cursor AI from the terminal.
- AppArmor Profile Management: Ensures proper execution security.
- Automatic Language Detection: Intelligently detects system language (English/Spanish) from environment variables, directories, and system settings.
- System Information Display: Shows detected language, directories, and current installation status.
- Enhanced Process Management: Smart detection and handling of running Cursor processes during updates.
- Flexible Configuration: Extensive environment variable support for customization.
Unlike the original cursor-setup-wizard, this version does not use GUM for user interface prompts. All interactions are handled using standard shell commands (e.g., read).
This script automatically downloads the latest version from the cursor-ai-downloads repository. The script will:
- Detect your system architecture (x64 or ARM64)
- Fetch the latest version information from the repository
- Automatically download the appropriate AppImage for your system
- Install and configure the application
This ensures you always get the most recent version available, eliminating the need for manual downloads.
The script automatically downloads Cursor AI AppImages from the cursor-ai-downloads repository on GitHub. This repository is:
- Maintained by the community with official Cursor AI releases
- Regularly updated with the latest stable versions
- Verified source for Linux AppImage downloads
- Trusted by the community for automated installations
- Repository Query: The script queries the
README.mdfile fromcursor-ai-downloads - Version Extraction: Parses the latest version number using pattern matching
- Architecture Detection: Determines your system (x64/ARM64) automatically
- URL Construction: Builds the correct download URL for your specific version and architecture
- Secure Download: Downloads directly from GitHub's CDN for fast and reliable transfers
The script recognizes and handles Cursor versions in the format: Cursor-X.Y.Z
- X: Major version (e.g., 1, 2, 3...)
- Y: Minor version (e.g., 0, 1, 2...)
- Z: Patch version (e.g., 0, 1, 5, 11...)
- SHA256 Checksums: The repository provides checksums for verification
- Official Builds: Downloads come from official Cursor AI builds
- GitHub CDN: Downloads use GitHub's secure content delivery network
- Transparent Process: You can manually verify the download URLs before installation
The script uses a two-step process for security and reliability:
-
Version Detection (from GitHub repository):
- Fetches version information from
cursor-ai-downloadsrepository - Extracts the latest version number from the repository's README
- No downloads happen from this repository - only metadata
- Fetches version information from
-
Actual Download (from official Cursor servers):
- Uses the version info to construct official download URLs
- Downloads directly from
downloads.cursor.com(official CDN) - Validates file integrity after download
Example Process:
1. Check https://github.com/oslook/cursor-ai-downloads โ Finds version 1.5.6
2. Download from https://downloads.cursor.com/production/.../Cursor-1.5.6-x86_64.AppImage
Manual Verification: You can visit the cursor-ai-downloads repository to see the latest available versions and verify the download URLs that the script will use.
The script now automatically detects your system language using multiple methods:
- Environment Variables:
LANGandLANGUAGEvariables - Directory Existence: Checks for
~/Escritorioor~/Desktop - System Locale: Uses
localecommand output - GNOME/KDE Settings: Reads
~/.config/user-dirs.dirs
- English (EN):
- Downloads folder:
~/Downloads - Desktop folder:
~/Desktop
- Downloads folder:
- Spanish (ES):
- Downloads folder:
~/Descargas - Desktop folder:
~/Escritorio
- Downloads folder:
You can override auto-detection by setting the LANG_SETTING environment variable:
LANG_SETTING=EN ./cursor-setup-ubuntu.sh # Force English
LANG_SETTING=ES ./cursor-setup-ubuntu.sh # Force SpanishThe script will show which language was detected during the system requirements check.
git clone https://github.com/dannetstudio/cursor-setup-ubuntu.git
cd cursor-setup-ubuntuwget https://raw.githubusercontent.com/dannetstudio/cursor-setup-ubuntu/main/cursor-setup-ubuntu.shchmod +x cursor-setup-ubuntu.shThe script automatically detects your system language (English/Spanish) and configures directories accordingly. You can override auto-detection by setting the LANG_SETTING environment variable if needed.
Execute the script:
./cursor-setup-ubuntu.shOnce installed for the first time, an alias cursor-setup-ubuntu will be created for easy future access. To make it available in your current session, run:
source ~/.bashrc # For Bash users
source ~/.zshrc # For Zsh usersAfter this, you can run the script anytime with:
cursor-setup-ubuntuYou will be presented with a text-based menu offering the following options:
- Check for Updates & Install/Update Cursor - Intelligently checks your current installation, compares with the latest version, and only downloads/installs if necessary
- Update Desktop Shortcut - Creates or updates the desktop shortcut and icon (useful if you manually moved the AppImage)
- Show System Information - Displays detected language, directories, and system settings
- Exit - Exit the script
The script uses an intelligent process that avoids unnecessary downloads:
- Check Installation: Detects that Cursor is not installed
- Fetch Latest Version: Queries the latest version from the repository
- Download Confirmation: Asks if you want to download the latest version
- Smart Download: Downloads only if you confirm
- Installation: Installs and configures the application
- Check Current Version: Detects your currently installed version
- Compare Versions: Compares with the latest available version
- Update Assessment:
- Up to date: Shows success message, no download needed
- Update available: Shows version difference and asks for confirmation
- Not installed: Offers fresh installation
- Selective Download: Downloads only if update is needed and confirmed
- Smart Installation: Handles file conflicts and creates backups automatically
- No unnecessary downloads - Only downloads when needed
- Bandwidth efficient - Avoids re-downloading the same version
- User control - Always asks before downloading large files
- Intelligent detection - Knows your current installation status
-
The script creates or updates a desktop shortcut that launches the AppImage with the
--no-sandboxflag. -
A wrapper script is generated, and a symlink is set up in
/usr/local/binso you can launch the AppImage from the terminal usingcursor. -
A single alias (
cursor-setup-ubuntu) is also created for easy future access to the script. -
The script ensures compatibility with bashrc and zshrc, so users can execute commands seamlessly from both Bash and Zsh shells.
When updating Cursor, the script intelligently handles situations where the AppImage file is currently in use:
- Automatic Detection: Uses
lsofto detect if the current AppImage is being used by running processes - Safe Backup: Creates timestamped backups before replacing files
- Process Management: Offers to terminate conflicting processes (with user confirmation)
- Graceful Handling: If you run the script from within Cursor, it will detect this and ask for confirmation
Note: If running the script from within Cursor, it will detect that the AppImage is in use and offer to terminate the process. This is normal behavior and ensures safe updates.
The script supports various environment variables for customization:
LANG_SETTING=ES # Force Spanish (ES) or English (EN)
# If not set, auto-detection is usedLOG_COLORS=true # Enable/disable colored output
DEBUG_MODE=false # Enable debug loggingMENU_TIMEOUT=300 # Menu timeout in seconds (default: 300)
CONFIRMATION_TIMEOUT=60 # Confirmation prompt timeout (default: 60)
DOWNLOAD_TIMEOUT=300 # Download timeout (default: 300)
CURL_TIMEOUT=5 # Repository query timeout (default: 5)
CURL_PING_TIMEOUT=2 # Connectivity test timeout (default: 2)
MAX_RETRY_ATTEMPTS=3 # Maximum retry attempts (default: 3)CURSOR_REPO_URL="https://..." # Override repository URL
CURSOR_DOWNLOAD_BASE_URL="https://..." # Override download base URL- Operating System: Ubuntu or Ubuntu-based distributions (e.g., Xubuntu, Kubuntu, Linux Mint, etc.)
- Tools Required:
curl,sudo, and standard shell utilities. - Permissions: Ability to modify files in
/etc/apparmor.d/and create symlinks in/usr/local/bin/.
This project is not affiliated with Cursor AI. It is an independent effort to improve the installation and update experience on Linux, addressing common setup steps and potential issues.
This script is inspired by the original cursor-setup-wizard project and has been adapted to automatically download the latest version on Ubuntu without using GUM.
Contributions are welcome! If you have improvements or suggestions, please open an issue or submit a pull request.
This script was created by Daniel Ignacio Fernรกndez (https://dannetstudio.com).