Cursor install Ubuntu 24.04

Cursor AI is a modern AI-driven IDE that boosts productivity for developers. This guide shows how to set up Cursor on your Linux system using a simple script that handles dependencies, downloads the Cursor AppImage, and creates a convenient desktop launcher.

Prerequisites

Ensure you have curl installed on your system. You can install it by running:

bash

Copy code

sudo apt-get update
sudo apt-get install -y curl

Note: If you use a different package manager (like dnf for Fedora or zypper for openSUSE), use it instead.

Installation Script

  1. Copy and paste the following script into a file (e.g., install_cursor.sh):

bash

Copy code

#!/bin/bash

installCursor() {
    if ! [ -f /opt/cursor.appimage ]; then
        echo "Installing Cursor AI IDE..."

        # URLs for Cursor AppImage and Icon
        CURSOR_URL="https://downloader.cursor.sh/linux/appImage/x64"
        ICON_URL="https://raw.githubusercontent.com/rahuljangirwork/copmany-logos/refs/heads/main/cursor.png"

        # Paths for installation
        APPIMAGE_PATH="/opt/cursor.appimage"
        ICON_PATH="/opt/cursor.png"
        DESKTOP_ENTRY_PATH="/usr/share/applications/cursor.desktop"

        # Install curl if not installed
        if ! command -v curl &> /dev/null; then
            echo "curl is not installed. Installing..."
            sudo apt-get update
            sudo apt-get install -y curl
        fi

        # Download Cursor AppImage
        echo "Downloading Cursor AppImage..."
        sudo curl -L $CURSOR_URL -o $APPIMAGE_PATH
        sudo chmod +x $APPIMAGE_PATH

        # Download Cursor icon
        echo "Downloading Cursor icon..."
        sudo curl -L $ICON_URL -o $ICON_PATH

        # Create a .desktop entry for Cursor
        echo "Creating .desktop entry for Cursor..."
        sudo bash -c "cat > $DESKTOP_ENTRY_PATH" <<EOL
[Desktop Entry]
Name=Cursor AI IDE
Exec=$APPIMAGE_PATH
Icon=$ICON_PATH
Type=Application
Categories=Development;
EOL

        echo "Cursor AI IDE installation complete. You can find it in your application menu."
    else
        echo "Cursor AI IDE is already installed."
    fi
}

installCursor
  1. Save the file and make it executable:

bash

Copy code

chmod +x install_cursor.sh
  1. Run the script:

bash

Copy code

./install_cursor.sh

Explanation

  • Dependency Installation: The script checks if curl is installed and installs it if necessary.
  • AppImage Download: It downloads the Cursor AppImage from the specified URL.
  • Icon Download: It retrieves an icon to be used in the application menu.
  • Desktop Entry Creation: The script creates a .desktop file, allowing you to launch Cursor from your application menu easily.

Launch Cursor

Once the script completes, you can find Cursor AI in your applications menu. Click to open and start coding!

5 Likes