If you're like me, you're always on the lookout for new tools that can enhance your programming experience. Recently, I came across a tweet by Andrej Karpathy about using VS Code Cursor with Sonnet 3.5, and it got me curious.

If you're excited to try out Cursor Code Editor on your Linux machine, You can download the AppImage from their official website.

None
Official Site Home Page

But if you find it inconvenient to launch the AppImage manually each time, you're in the right place. In this guide, I'll walk you through the process of integrating Cursor IDE into your system as a fully-fledged Linux application. With these simple steps, you'll have Cursor IDE up and running seamlessly, just like any other application on your desktop.

Let's get started!

Step-by-Step Installation Guide

Step 1: Create a Folder for Cursor IDE

First things first, let's create a dedicated folder for Cursor IDE. Open your terminal and run the following command:

mkdir -p ~/Applications/cursor

This will create a new folder named "cursor" inside the "Applications" directory in your home folder.

Step 2: Download the Latest Version of Cursor IDE

Next, we'll download the latest version of Cursor IDE using the following command:

wget -O ~/Applications/cursor/cursor.AppImage "https://downloader.cursor.sh/linux/appImage/x64"

This command will fetch the Cursor IDE AppImage and save it in the "cursor" folder we just created.

Step 3: Make the AppImage Executable

To ensure that the AppImage is executable, run this command:

chmod +x ~/Applications/cursor/cursor.AppImage

This step is usually not necessary, as the AppImage should already be executable, but it's always good to double-check! ๐Ÿ˜‰

Step 4: Create a Symlink for Easy Access

Let's create a symlink so that you can launch Cursor IDE from anywhere in the terminal:

sudo ln -s ~/Applications/cursor/cursor.AppImage /usr/local/bin/cursor

Now, you can simply type cursor in your terminal to launch the application. Pretty cool, right? ๐Ÿ˜Ž

Step 5: Add a Cursor IDE Icon

To make things even more awesome, let's add a Cursor IDE icon. Download this image

None
icon

and save it as cursor-icon.png in the ~/Applications/cursor/ folder.

Step 6: Create a Desktop Entry

Now, let's create a desktop entry to make Cursor IDE accessible from your application menu:

vim ~/.local/share/applications/cursor.desktop

This will open the Vim text editor. Copy and paste the following code into the file:

[Desktop Entry]
Name=Cursor
Exec=/home/[your_username]/Applications/cursor/cursor.AppImage
Icon=/home/[your_username]/Applications/cursor/cursor-icon.png
Type=Application
Categories=Utility;Development;

Make sure to replace [your_username] with your actual username. Then, type :wq, and finally press Enter to save the changes and exit Vim.

Step 7: Create an Update Script

To make updating Cursor IDE a breeze, let's create an update script:

vim ~/Applications/cursor/update-cursor.sh

Copy and paste the following code into the script:

#!/bin/bash

APPDIR=~/Applications/cursor
APPIMAGE_URL="https://downloader.cursor.sh/linux/appImage/x64"

wget -O $APPDIR/cursor.AppImage $APPIMAGE_URL
chmod +x $APPDIR/cursor.AppImage

Then, type :wq, and finally pressEnter to save the changes and exit Vim.

Step 8: Make the Update Script Executable

To make the update script executable, run this command:

chmod +x ~/Applications/cursor/update-cursor.sh

Step 9: Create a Service to Update Cursor IDE at Startup

Let's create a service that will automatically update Cursor IDE every time you start your computer:

vim ~/.config/systemd/user/update-cursor.service

Copy and paste the following code into the service file:

[Unit]
Description=Update Cursor

[Service]
ExecStart=/home/[your_username]/Applications/cursor/update-cursor.sh
Type=oneshot

[Install]
WantedBy=default.target

Again, replace [your_username] with your actual username.

Then, type :wq, and finally pressEnter to save the changes and exit Vim.

If you notice this error E212: Can't open file for writing while saving the file, it means the systemd directory itself doesn't exists. So, lets first create it,

mkdir -p ~/.config/systemd/user
vim ~/.config/systemd/user/update-cursor.service

and rest of the steps remains the same.

Step 10: Enable and Start the Update Service

Finally, enable and start the update service with these commands:

systemctl --user enable update-cursor.service
systemctl --user start update-cursor.service

If you notice systemctl errors in this step, check its status first,

systemctl --user status

It should show State: running.

And, if you notice errors likeFailed to connect to bus: Connection refused . Try manually starting the dbus service,

eval $(dbus-launch --sh-syntax)

This should start the dbus session, after which you can try running your systemctl --user command again.

If your shell environment is not correctly configured, you might need to manually set up your environment variables.

Add the following lines to your .zshrc file:

export XDG_RUNTIME_DIR="/run/user/$(id -u)"
export DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"

After adding these lines, reload your .zshrc file:

source ~/.zshrc

Ensure that your system is configured to start systemd user services:

loginctl show-session $(loginctl | grep $(whoami) | awk '{print $1}') -p Type

If the output isn't Type=x11, it indicates that your session isn't being managed by systemd, which might require further configuration depending on your system and desktop environment.

If dbus-launch is not installed in your system, you need to install it first,

sudo apt-get update && sudo apt-get upgrade
sudo apt install dbus-x11

Restart the system

sudo reboot

and now check the status again

systemctl --user status

It should show State: running

Enjoy Cursor!

And there you have it! You've successfully installed Cursor IDE on your Linux machine. ๐ŸŽ‰ Now you can enjoy the power of AI-assisted coding and experience the future of programming firsthand.

None
Rust Project on Cursor Code Editor

Check out Cursor Docs page for further information.

Happy coding, and may the AI be with you! ๐Ÿ––๐Ÿ˜„.

Clap ๐Ÿ‘ if you found it helpful!!!