This repository contains the necessary files and automation to build a restrictive, sandboxed Flatpak for the Cursor AI code editor.
The primary goal is to provide a secure environment for running Cursor by
limiting its access to the host system. The build process is automated with a
Makefile, requiring only the version number and download URL for a new release
to build and package it.
- Prerequisites
- Project Structure
- How to Build
- Makefile Targets
- Post-Install Customization with Flatseal
Before you can build the Flatpak, you must have the following tools installed on your system:
flatpakflatpak-buildermakewget
You also need to have the Flathub remote added to your Flatpak installation:
flatpak remote-add --if-not-exists flathub [https://flathub.org/repo/flathub.flatpakrepo](https://flathub.org/repo/flathub.flatpakrepo)This repository contains the following files:
Makefile: The main script that automates the entire download, build, and installation process.com.cursor.App.yml: The Flatpak manifest. This is the core blueprint that tellsflatpak-builderhow to construct the application, including its dependencies, sources, and sandbox permissions.com.cursor.App.appdata.xml: AppStream metadata for the application. This file provides the information (name, description, version history) that software centers like GNOME Software and KDE Discover use to display the application.com.cursor.App.desktop: The.desktopfile that allows the application to be launched from your desktop environment's application menu.
The build process is managed entirely by the Makefile.
-
Find the Release URL and Version: Go to the Cursor Download History or the official website to find the download URL for the Linux AppImage of the version you want to package.
-
Run the Build Command: From the root of this project directory, run the
makecommand, providing theVERSIONandCURSOR_URLas arguments.Example:
make build VERSION=x.y.z CURSOR_URL="URL_FOR_XYZ_RELEASE_OBTAINED_FROM_WEBSITE"This command will:
- Download the specified AppImage.
- Make it executable and extract its contents.
- Update the version number in the
appdata.xmlfile. - Run
flatpak-builderto create the Flatpak in abuild-dirdirectory.
-
Install the Flatpak: Once the build is complete, you can install it for your user with:
make install
-
Run the Application:
Once installed, you can normally run your application with:
flatpak run codes.t3.appThe Makefile provides several convenient targets:
make build: Downloads the AppImage and builds the Flatpak. (RequiresVERSIONandCURSOR_URL).make install: Installs the locally built Flatpak for the current user.make run: Runs the installed Flatpak application.make uninstall: Removes the Flatpak from your system.make clean: Removes all build artifacts, includingbuild-dir,repo, the downloaded AppImage, and the extractedsquashfs-root.
For easy, on-the-fly permission management without rebuilding, you can use Flatseal, a graphical utility for managing Flatpak permissions.
-
Install Flatseal:
flatpak install flathub com.github.tchx84.Flatseal
-
Launch Flatseal and select "Cursor" from the list of applications.
-
You can now toggle permissions for filesystem access, network sockets, device access, and more. Changes are applied instantly.
- Allow operating the flatpak without "--share-network": The work for this is ongoing with the slirp4netns_helper.py script that is meant to inject networking to the isolate network namespace of the Flatpak.
- Automate download of the latest version
- Automate builds with github actions.