DEV Community

Cover image for How to Install Cursor AI Code Editor on Ubuntu Linux: A Complete Step-by-Step Guide
Saif Warraich
Saif Warraich

Posted on

How to Install Cursor AI Code Editor on Ubuntu Linux: A Complete Step-by-Step Guide

Cursor is an AI-powered code editor built as a fork of Visual Studio Code, bringing advanced AI capabilities directly into your coding workflow. If you're running Ubuntu or any Debian-based Linux distribution, this guide will walk you through the complete installation process.

Prerequisites

  • Ubuntu 22.04 or any Debian-based Linux distribution
  • Terminal access with sudo privileges
  • Basic familiarity with command-line operations

Step 1: Download Cursor

First, visit cursor.com/downloads and download the Linux version. The download will be an AppImage file (approximately named Cursor-1.4.5-x86_64.AppImage).

Step 2: Make the AppImage Executable

Navigate to your downloads directory and make the AppImage executable:

chmod a+x Cursor-1.4.5-x86_64.AppImage
Enter fullscreen mode Exit fullscreen mode

Why this step? AppImage files need executable permissions to run. By default, downloaded files don't have execute permissions for security reasons.

Step 3: Install FUSE Library

Install the required FUSE library that AppImages need to function:

sudo apt install libfuse2t64
Enter fullscreen mode Exit fullscreen mode

Why this step? AppImages use FUSE (Filesystem in Userspace) to mount and run applications. Without this library, the AppImage won't execute properly.

Step 4: Move Cursor to a Permanent Location

Move the AppImage to a system directory for easier access:

sudo mv Cursor-1.4.5-x86_64.AppImage /opt/cursor.AppImage
Enter fullscreen mode Exit fullscreen mode

Why this step? Placing the application in /opt/ follows Linux conventions for optional software packages and ensures it's available system-wide rather than cluttering your downloads folder.

Step 5: Create a Desktop Entry (Optional but Recommended)

Create a desktop entry so Cursor appears in your applications menu:

sudo vi /usr/share/applications/cursor.desktop
Enter fullscreen mode Exit fullscreen mode

We're using Vim here (the terminal text editor that's either your best friend or your worst nightmare). Add the following content to the file:

[Desktop Entry]
Name=Cursor
Exec=/opt/cursor.AppImage
Icon=/path/to/cursor/logo.png
Type=Application
Categories=Development;
Enter fullscreen mode Exit fullscreen mode

Creating the Cursor desktop entry file in Vim editor with the configuration that adds Cursor to the applications menu

First time using Vim? Here's your survival guide:

Press i to enter Insert mode (now you can type)
Press Esc to exit Insert mode
Type :wq and press Enter to save and quit
If you mess up, type :q! to quit without saving

Why this step? Desktop entries allow you to launch applications from your desktop environment's application menu instead of always using the terminal.

Note: You can download a Cursor logo or use any icon you prefer. Just update the Icon path accordingly, or omit this line if you don't want a custom icon.

Step 6: Create a Wrapper Script

Create a convenient command-line launcher:

sudo vi /usr/local/bin/cursor
Enter fullscreen mode Exit fullscreen mode

Add this content:

#!/bin/bash
/opt/cursor.AppImage "$@" > /dev/null 2>&1 &
Enter fullscreen mode Exit fullscreen mode

Adding the bash wrapper script content in Vim that allows launching Cursor from terminal with clean output

Make the script executable:

sudo chmod +x /usr/local/bin/cursor
Enter fullscreen mode Exit fullscreen mode

Why this step? This wrapper script allows you to launch Cursor from anywhere in your terminal by simply typing cursor. It also runs the application in the background and suppresses output to keep your terminal clean.

Step 7: Configure AppArmor Security Profile

Create a security profile for AppArmor (Ubuntu's security system):

sudo vi /etc/apparmor.d/cursor-appimage
Enter fullscreen mode Exit fullscreen mode

Add this content:

#include <tunables/global>

profile cursor /opt/cursor.AppImage flags=(unconfined) {
    #include <abstractions/base>

    /opt/cursor.AppImage mr,
    owner @{HOME}/** rw,
    /tmp/** rwk,
    /proc/sys/kernel/yama/ptrace_scope r,
    /sys/devices/system/cpu/cpufreq/policy*/cpuinfo_max_freq r,
}
Enter fullscreen mode Exit fullscreen mode

Configuring the AppArmor security profile in Vim to define system resource access permissions for Cursor

Load the security profile:

sudo apparmor_parser -r /etc/apparmor.d/cursor-appimage
Enter fullscreen mode Exit fullscreen mode

Why this step? This creates a security profile that defines what system resources Cursor can access. Recent Ubuntu versions may block AppImages without proper AppArmor profiles, so this prevents potential security errors.

Step 8: Launch Cursor

Now you can launch Cursor in several ways:

  1. From terminal: Simply type cursor . (the dot opens current directory)
  2. From applications menu: Look for Cursor in your development applications
  3. Direct execution: Run /opt/cursor.AppImage

Troubleshooting Tips

  • If you encounter permission issues, ensure all files have correct permissions
  • For older Ubuntu versions, you might need libfuse2 instead of libfuse2t64
  • If AppArmor blocks execution, verify the security profile is correctly loaded

Installing Cursor on Ubuntu is straightforward once you understand each step's purpose. The installation process might seem involved, but each step serves a specific purpose in creating a robust, secure, and user-friendly setup.

Have you tried Cursor on Linux? Share your experience in the comments below! If this guide helped you, please give it a like and share it with other developers.

Top comments (2)

Collapse
 
mabbasbangash97 profile image
Muhammad Abbas Bangash

much needed...

Collapse
 
zeer profile image
Zohran

Well explained