How to Install the Cursor (The AI Code Editor) on Ubuntu 24.04: A Simple Guide

forhad_hosain_d27ef1edf40

Forhad Hosain

Posted on September 2, 2024

How to Install the Cursor (The AI Code Editor) on Ubuntu 24.04: A Simple Guide

If you're planning to install Cursor on Ubuntu 24.04, this guide will lead you through the entire process step by step. From setting up the necessary dependencies to creating a desktop entry, and configuring your system so you can easily open a project using the cursor .

Step 1: Install Fuse

To begin, you’ll need to install Fuse, which is a prerequisite for running AppImage files. Use the following command to install libfuse2t64:

sudo apt install libfuse2t64
Enter fullscreen mode Exit fullscreen mode

Step 2: Download the Cursor AppImage

Head over to the official Cursor website and download the AppImage file. Make sure to note the exact file name and version.

Step 3: Make the AppImage Executable

Once you’ve downloaded the Cursor AppImage, navigate to the directory where it’s located, typically the Downloads folder:

cd ~/Downloads
Enter fullscreen mode Exit fullscreen mode

Next, make the AppImage file executable by running:

chmod +x cursor-0.39.5x86_64.AppImage
Enter fullscreen mode Exit fullscreen mode

(Modify the file name to match the version you downloaded.)

Step 4: Move the AppImage to a Permanent Location

For easier access, move the AppImage file to the /opt directory and rename it to something simple like cursor.AppImage:

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

Step 5: Create a Desktop Entry for Cursor

To make Cursor easily accessible from your applications menu, you’ll need to create a desktop entry. Open a text editor with root privileges:

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

Add the following content to the file:

[Desktop Entry]
Name=Cursor
Exec=/opt/cursor.AppImage
Icon=<CHANGE THIS TO THE LOCATION OF YOUR ICON FILE>
Type=Application
Categories=Development;
Enter fullscreen mode Exit fullscreen mode

Make sure to replace the Icon path with the actual location of your icon file. If you don’t have an icon yet, see the next step.

Step 6: Get an Icon for Cursor

You’ll want a nice icon to go with your application. Here’s how you can create one:

Download a logo: Visit the official Cursor website and find the logo video.

Extract an image: Use EZGIF or another tool to create an image from the video.

Round the edges: You can use online tools or image editing software to round the edges of the icon.

Save the icon: Create a directory to store your icons:

mkdir -p ~/.local/share/icons
Enter fullscreen mode Exit fullscreen mode

Save your icon in this directory and update the Icon path in your .desktop file.

...
Icon=<HOME_DIRECTORY>/.local/share/icons/cursor-logo.png
...
Enter fullscreen mode Exit fullscreen mode

Step 7: Fix the AppArmor Error

Sometimes, running the AppImage may trigger an AppArmor error. Here’s how to fix it:

Create an AppArmor profile: Open a new file in the following location:

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

Add the following content:

abi <abi/4.0>,
include <tunables/global>

profile cursor /opt/cursor.AppImage flags=(unconfined) {
  userns,
  include if exists <local/cursor>
}
Enter fullscreen mode Exit fullscreen mode

Run the parser to apply the changes:

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

Step 8: Create a Wrapper Script

To make launching Cursor easier, create a wrapper script:

Create the script:

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

Add the following content:

#!/bin/bash
/opt/cursor.AppImage "$@" > /dev/null 2>&1 &
"$@" passes any arguments you give to the cursor command.
> /dev/null 2>&1 & runs the command in the background, keeping your terminal free.
Enter fullscreen mode Exit fullscreen mode

Make the script executable:

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

Step 9: Test the Setup

Finally, navigate to your project directory in the terminal and launch Cursor with:

cursor .
Enter fullscreen mode Exit fullscreen mode

This should open the Cursor editor without leaving a running session in the terminal.

And that’s it! You’ve successfully installed and set up Cursor on Ubuntu 24.04. Enjoy your coding with AI!

Update Cursor

To update Cursor to the latest version, first download the updated file from the official Cursor website, assuming the file is located in the ~/Downloads directory. Next, make the file executable and move it to the /opt directory by running the following commands in your terminal:

chmod +x ~/Downloads/cursor-<VERSION>.AppImage
sudo mv ~/Downloads/cursor-<VERSION>.AppImage /opt/cursor.AppImage
Enter fullscreen mode Exit fullscreen mode

Make sure to replace <VERSION> with the actual version number of the file you've downloaded. Restart your computer if the icon does not appear properly.

References

💖 💪 🙅 🚩
forhad_hosain_d27ef1edf40
Forhad Hosain

Posted on September 2, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related