Disabling Auto-Updates
Relevant source files
The following files were used as context for generating this wiki page:
The "Disabling Auto-Updates" feature is a crucial component of the cursor-free-vip toolset, designed to prevent the Cursor application from updating itself automatically. This is achieved through a multi-step process that involves terminating active Cursor processes, removing or modifying critical update-related files and directories, and altering configuration files to remove update URLs. This ensures that any patches or modifications applied by other tools in this repository are not overwritten by an official application update.
The core logic is encapsulated within the AutoUpdateDisabler class in disable_auto_update.py. The feature is accessible to the user through option 7 in the main menu.
Sources: disable_auto_update.py, main.py:403-405, locales/en.json:181-203
System Architecture
The auto-update disabler is implemented in the AutoUpdateDisabler class. It identifies the user's operating system and uses pre-configured paths to locate and manipulate the necessary files and directories associated with Cursor's update mechanism.
Sources: disable_auto_update.py:22-25
Core Component: AutoUpdateDisabler Class
The AutoUpdateDisabler class is the central component responsible for the entire update disabling process.
The following diagram shows the structure of the AutoUpdateDisabler class.
Sources: disable_auto_update.py:22-248
Path Configuration
On initialization, the AutoUpdateDisabler class determines the correct paths for the updater directory, update.yml file, and product.json file based on the operating system (Windows, macOS, or Linux). These paths are retrieved from the config.ini file.
| Operating System | Target | Default Path |
|---|---|---|
| Windows | updater_path | %LOCALAPPDATA%\cursor-updater |
update_yml_path | %LOCALAPPDATA%\Programs\Cursor\resources\app\update.yml | |
product_json_path | %LOCALAPPDATA%\Programs\Cursor\resources\app\product.json | |
| macOS | updater_path | ~/Library/Application Support/cursor-updater |
update_yml_path | /Applications/Cursor.app/Contents/Resources/app-update.yml | |
product_json_path | /Applications/Cursor.app/Contents/Resources/app/product.json | |
| Linux | updater_path | ~/.config/cursor-updater |
update_yml_path | ~/.config/cursor/resources/app-update.yml | |
product_json_path | ~/.config/cursor/resources/app/product.json |
Sources: disable_auto_update.py:28-63
Process Flow
The disable_auto_update method orchestrates a sequence of five distinct operations to comprehensively disable the update functionality. The process is designed to be resilient, continuing even if some non-critical steps like directory removal fail.
This flowchart illustrates the sequence of actions taken by the disable_auto_update method.
Sequence of Operations
The following sequence diagram shows the interaction between the user, the main script, and the AutoUpdateDisabler module.
Key Operations
The process is broken down into several key methods, each targeting a different aspect of the Cursor update mechanism.
1. Terminating Cursor Processes
The first step is to terminate all running Cursor processes to prevent file locking issues. The _kill_cursor_processes method uses OS-specific commands to achieve this.
- Windows:
taskkill /F /IM Cursor.exe /T - Linux/macOS:
pkill -f Cursor
This ensures that the application is not running while its files are being modified.
Sources: disable_auto_update.py:112-126, locales/en.json:187-188
2. Removing the Updater Directory
The _remove_updater_directory method attempts to delete the cursor-updater directory. If the directory is locked (e.g., due to insufficient permissions), it prints a warning and skips the step, allowing the script to proceed.
Sources: disable_auto_update.py:128-150, locales/en.json:189-190
3. Clearing and Locking update.yml
The _clear_update_yml_file method erases the contents of the update.yml file, which is used by the updater to manage update information. If the file does not exist, the step is skipped.
Subsequently, the _create_blocking_file method writes a lock message to update.yml and sets its permissions to read-only (0o444 on Unix-like systems, attrib +r on Windows) to prevent the application from modifying it.
Sources: disable_auto_update.py:152-174, disable_auto_update.py:202-215, locales/en.json:193-196
4. Creating Blocking Files
The _create_blocking_file method performs two critical actions to block updates:
- It creates an empty file at the
updater_pathand sets its permissions to read-only. This prevents the updater executable or directory from being created. - It writes a placeholder content to
update.ymland sets it to read-only, effectively locking it.
This two-pronged approach ensures that even if one blocking mechanism fails, the other is likely to succeed.
Sources: disable_auto_update.py:176-226, locales/en.json:191-192
5. Removing Update URLs
The final step, handled by _remove_update_url, is to modify the product.json file. This method uses regular expressions to find and remove hardcoded update server URLs. This prevents the application from being able to contact the update servers.
The following URLs are targeted for removal:
https://api2.cursor.sh/aiserver.v1.AuthService/DownloadUpdatehttps://api2.cursor.sh/updateshttp://cursorapi.com/updates
# From disable_auto_update.py
patterns = {
r"https://api2.cursor.sh/aiserver.v1.AuthService/DownloadUpdate": r"",
r"https://api2.cursor.sh/updates": r"",
r"http://cursorapi.com/updates": r"",
}
for pattern, replacement in patterns.items():
content = re.sub(pattern, replacement, content)
Sources: disable_auto_update.py:70-110, reset_machine_manual.py, totally_reset_cursor.py
Summary
The "Disabling Auto-Updates" feature employs a robust, multi-layered strategy to prevent the Cursor application from updating. By terminating processes, deleting updater directories, clearing and locking configuration files, and removing hardcoded update URLs, it effectively isolates the application from its update mechanism. This is essential for maintaining the integrity of the patches applied by the cursor-free-vip tool.
Sources: disable_auto_update.py