Machine ID Management
Relevant source files
The following files were used as context for generating this wiki page:
The Machine ID Management system is a core feature of the cursor-free-vip project, designed to manipulate various identifiers used by the Cursor application. Its primary purpose is to reset these identifiers to bypass trial limitations and to provide a mechanism for restoring them from backups. The system operates by modifying Cursor's local configuration files, application databases, and certain system-level identifiers on Windows and macOS.
The functionality is encapsulated in two main scripts: reset_machine_manual.py for resetting identifiers and restore_machine_id.py for restoring them. These scripts are driven by a central configuration file (config.ini) and are designed to be cross-platform, with specific logic for Windows, macOS, and Linux.
Architecture Overview
The system is composed of several key components that interact to manage Cursor's machine identifiers. The main Python classes, MachineIDResetter and MachineIDRestorer, orchestrate the modification of various files and system settings.
Sources: reset_machine_manual.py, restore_machine_id.py
Component Interaction
The following diagram illustrates the relationship between the management scripts and the files they modify.
Core Classes
The system's logic is primarily contained within two classes.
Configuration Management
The scripts rely on a central configuration file, config.ini, located in the user's Documents folder under .cursor-free-vip. This file stores OS-specific paths to Cursor's application and data directories. If the file or directory does not exist, the scripts will create it with default paths.
Sources: reset_machine_manual.py:70-185, totally_reset_cursor.py:70-185
| Section | Key | Description | Example Value (Windows) |
|---|---|---|---|
WindowsPaths | cursor_path | Path to Cursor's app resources directory. | %LOCALAPPDATA%\Programs\Cursor\resources\app |
WindowsPaths | machine_id_path | Path to the machineId file. | %APPDATA%\Cursor\machineId |
WindowsPaths | storage_path | Path to the storage.json file. | %APPDATA%\Cursor\User\globalStorage\storage.json |
WindowsPaths | sqlite_path | Path to the state.vscdb SQLite database. | %APPDATA%\Cursor\User\globalStorage\state.vscdb |
MacPaths | cursor_path | Path to Cursor's app resources directory. | /Applications/Cursor.app/Contents/Resources/app |
MacPaths | machine_id_path | Path to the machineId file. | ~/Library/Application Support/Cursor/machineId |
LinuxPaths | cursor_path | Path to Cursor's app resources directory. | /opt/Cursor/resources/app |
LinuxPaths | machine_id_path | Path to the machineid file. | ~/.config/cursor/machineid |
Sources: reset_machine_manual.py:75-185, 187-220, 621-690, totally_reset_cursor.py:75-185, 187-220, 570-639
Machine ID Reset Process
The reset_machine_manual.py and totally_reset_cursor.py scripts execute a full reset of all known machine identifiers. This process is destructive and is intended to give the user a "fresh start" with the Cursor application.
Sources: reset_machine_manual.py:768-832, locales/en.json:40
Reset Workflow
The reset process follows a sequence of steps to generate new IDs and apply them across multiple locations.
This diagram shows the flow of the reset_machine_ids function.
Sources: reset_machine_manual.py:768-832, totally_reset_cursor.py:757-821
ID Generation
The generate_new_ids method creates a new set of identifiers using uuid and hashlib.
| Identifier | Generation Method | Description |
|---|---|---|
telemetry.devDeviceId | str(uuid.uuid4()) | A standard UUIDv4. Also used for storage.serviceMachineId. |
telemetry.machineId | hashlib.sha256(os.urandom(32)).hexdigest() | A 64-character hex string from a SHA256 hash. |
telemetry.macMachineId | hashlib.sha512(os.urandom(64)).hexdigest() | A 128-character hex string from a SHA512 hash. |
telemetry.sqmId | "{" + str(uuid.uuid4()).upper() + "}" | A UUIDv4 formatted for SQM (Software Quality Metrics). |
Sources: reset_machine_manual.py:692-713, totally_reset_cursor.py:641-662
Data Storage Update
The newly generated IDs are persisted in two main locations within the Cursor user data directory:
storage.json: A JSON file where keys liketelemetry.devDeviceIdare updated directly.state.vscdb: A SQLite database. The script performs anINSERT OR REPLACEinto theItemTablefor each new ID.
Sources: reset_machine_manual.py:715-742, 800-808, totally_reset_cursor.py:664-691, 789-797
Machine ID Restoration Process
The restore_machine_id.py script allows users to restore previously backed-up machine identifiers. Backups are automatically created by the reset script.
Sources: restore_machine_id.py, locales/en.json:280
Restore Workflow
The restoration process involves user interaction to select a backup, followed by the application of the backed-up IDs.
This diagram shows the flow of the restore_machine_ids function.
Sources: restore_machine_id.py:293-340
Backup Discovery
Backups are located by searching for files matching the pattern storage.json.bak.* in the same directory as the original storage.json. The script lists these files, sorted by creation time, for the user to select.
Sources: restore_machine_id.py:72-99
System-Specific Operations
The scripts perform different operations depending on the host operating system to modify system-wide identifiers.
| OS | Target | Action |
|---|---|---|
| Windows | Registry: HKLM\SOFTWARE\Microsoft\Cryptography | Sets the MachineGuid value to the new telemetry.devDeviceId. |
| Windows | Registry: HKLM\SOFTWARE\Microsoft\SQMClient | Sets the MachineId value to the new telemetry.sqmId. |
| macOS | /var/root/Library/Preferences/SystemConfiguration/com.apple.platform.uuid.plist | Uses sudo plutil to replace the UUID string with the new telemetry.macMachineId. |
| Linux | N/A | No deep system-level ID modifications are performed. The script focuses on file-based identifiers within the user's home directory. |
Sources: reset_machine_manual.py:744-832, restore_machine_id.py:228-291
Application Patching
For Cursor versions 0.45.0 and newer, the reset scripts patch main.js to modify the behavior of the getMachineId function. This is a critical step to ensure the application uses the newly set IDs. The scripts use regular expressions to find and replace the relevant code.
Additionally, workbench.desktop.main.js is modified to alter UI elements, such as changing the "Upgrade to Pro" button to a link to the project's GitHub repository.
Sources: reset_machine_manual.py:448-564, 820-826, totally_reset_cursor.py:437-553, 809-815, locales/fr.json:80-82
main.js Patching
The following patterns are used to modify the machine ID retrieval logic:
patterns = {
r"async getMachineId\(\)\{return [^??]+\?\?([^}]+)\}": r"async getMachineId(){return \1}",
r"async getMacMachineId\(\)\{return [^??]+\?\?([^}]+)\}": r"async getMacMachineId(){return \1}",
}
This change effectively removes a fallback mechanism, forcing the application to use the identifier stored in its configuration.
Sources: reset_machine_manual.py:527-531, totally_reset_cursor.py:516-520
Conclusion
The Machine ID Management system is a comprehensive toolset for manipulating Cursor's identifiers across its configuration files, databases, and the underlying operating system. By providing both reset and restore capabilities, it gives users full control over the application's identity on their machine, primarily to circumvent trial restrictions. The inclusion of application code patching demonstrates a deep integration with Cursor's internal workings. The project is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International license.
Sources: reset_machine_manual.py, restore_machine_id.py, LICENSE.md