Complete Guide to Install Cursor AI IDE on Ubuntu 24.04
- Published on
- • 20 minutes read
In the world of software development, having efficient tools is crucial to optimizing workflow. Cursor AI IDE has become a popular AI-powered code editor designed to enhance developer productivity. This tutorial will guide you step by step on how to install Cursor AI IDE on Ubuntu 24.04, ensuring proper integration into your development environment.
Visit the official Cursor website at www.cursor.com and download the latest version of the AppImage file. This file allows you to run the software without a traditional installation.
To keep things organized, move the downloaded file to a dedicated applications folder:
cd ~/Downloads
mkdir -p ~/Applications
mv cursor-*.AppImage ~/Applications/cursor.AppImage
Cursor requires libfuse2
to function correctly. Install it by running:
sudo apt update
sudo apt install libfuse2
Ensure the AppImage has execution permissions:
chmod +x ~/Applications/cursor.AppImage
--no-sandbox
OptionDue to security configurations in Ubuntu 24.04, it is recommended to run Cursor with the --no-sandbox
option:
~/Applications/cursor.AppImage --no-sandbox
To make Cursor accessible from the application menu, create a .desktop
file:
Open a text editor with superuser privileges:
sudo nano /usr/share/applications/cursor.desktop
Add the following content:
[Desktop Entry]
Name=Cursor AI IDE
Exec=/home/your_user/Applications/cursor.AppImage --no-sandbox
Icon=/home/your_user/Applications/cursor.png
Type=Application
Categories=Development;
Replace your_user
with your actual username and ensure the icon path is correct.
Save and close the file.
To simplify launching Cursor from the terminal, add an alias to your shell configuration file:
Open .bashrc
file:
nano ~/.bashrc
Append the following line:
# Alias for Cursor AI IDE
alias cursor='~/Applications/cursor.AppImage --no-sandbox'
Save the file and reload the configuration:
source ~/.bashrc
You can automate all the previous steps using a script. Below is an example of a script based on the content of the gist (with incorporated corrections and comments from various users):
Open a text editor and save the following content in a file named, for example, install_cursor.sh
:
#!/bin/bash
# Definición de variables de rutas y URLs
APPIMAGE_PATH="/opt/cursor.appimage"
ICON_PATH="/opt/cursor.png"
DESKTOP_ENTRY_PATH="/usr/share/applications/cursor.desktop"
CURSOR_URL="https://downloader.cursor.sh/linux/appImage/x64"
ICON_URL="https://pub-e67c19bba5c64333a98782860493cce5.r2.dev/cursor.png"
# Función para instalar Cursor AI IDE
function installCursor() {
if [ -f "$APPIMAGE_PATH" ]; then
echo "Cursor AI IDE ya está instalado. Para actualizar, ejecute el script con el parámetro 'update'."
exit 0
fi
echo "Instalando Cursor AI IDE..."
# Verificar si curl está instalado
if ! command -v curl &> /dev/null; then
echo "curl no está instalado. Instalando..."
sudo apt-get update
sudo apt-get install -y curl
fi
# Descargar el AppImage
echo "Descargando Cursor AppImage..."
sudo curl -L $CURSOR_URL -o $APPIMAGE_PATH
sudo chmod +x $APPIMAGE_PATH
# Descargar el ícono
echo "Descargando el ícono de Cursor..."
sudo curl -L $ICON_URL -o $ICON_PATH
# Crear la entrada de escritorio (.desktop)
echo "Creando entrada de escritorio..."
sudo bash -c "cat > $DESKTOP_ENTRY_PATH" <<EOL
[Desktop Entry]
Name=Cursor AI IDE
Exec=$APPIMAGE_PATH --no-sandbox
Icon=$ICON_PATH
Type=Application
Categories=Development;
EOL
# Agregar alias al archivo de configuración de shell (.bashrc)
echo "Agregando alias 'cursor' a .bashrc..."
bash -c "cat >> \$HOME/.bashrc" <<EOL
# Alias para Cursor AI IDE
function cursor() {
$APPIMAGE_PATH --no-sandbox "\${@}" > /dev/null 2>&1 & disown
}
EOL
# Recargar la configuración del shell para aplicar el alias
source \$HOME/.bashrc
echo "Instalación completada. Puede iniciar Cursor AI IDE desde el menú de aplicaciones o usando el comando 'cursor'."
}
# Función para actualizar Cursor AI IDE
function updateCursor() {
if ! [ -f "$APPIMAGE_PATH" ]; then
echo "Cursor AI IDE no está instalado. Primero ejecute la instalación usando 'install'."
exit 1
fi
echo "Actualizando Cursor AI IDE..."
# Verificar si curl está instalado
if ! command -v curl &> /dev/null; then
echo "curl no está instalado. Instalando..."
sudo apt-get update
sudo apt-get install -y curl
fi
# Descargar la nueva versión del AppImage
echo "Descargando la nueva versión del AppImage..."
sudo curl -L $CURSOR_URL -o $APPIMAGE_PATH
sudo chmod +x $APPIMAGE_PATH
# Descargar el ícono actualizado
echo "Descargando el ícono actualizado..."
sudo curl -L $ICON_URL -o $ICON_PATH
echo "Actualización completada."
}
# Función para desinstalar Cursor AI IDE
function uninstallCursor() {
if ! [ -f "$APPIMAGE_PATH" ]; then
echo "Cursor AI IDE no está instalado."
exit 1
fi
echo "Desinstalando Cursor AI IDE..."
# Eliminar AppImage y el ícono
sudo rm -f $APPIMAGE_PATH
sudo rm -f $ICON_PATH
# Eliminar la entrada de escritorio
sudo rm -f $DESKTOP_ENTRY_PATH
# Avisar al usuario que el alias agregado en .bashrc deberá eliminarse manualmente
echo "Por favor, elimine manualmente la función alias 'cursor' de su archivo ~/.bashrc si ya no la desea."
echo "Desinstalación completada."
}
# Función para mostrar el uso del script
function showUsage() {
echo "Uso: $0 {install|update|uninstall}"
exit 1
}
# Comprobar que se haya pasado un parámetro
if [ -z "$1" ]; then
showUsage
fi
# Seleccionar la acción según el parámetro recibido
case "$1" in
install)
installCursor
;;
update)
updateCursor
;;
uninstall)
uninstallCursor
;;
*)
showUsage
;;
esac
chmod +x install_cursor.sh
sudo ./install_cursor.sh
Important: Since the script installs files in system directories (such as
/opt
and/usr/share/applications
), it must be executed with administrator privileges (usingsudo
).
AppImage
from www.cursor.com.~/Applications
or /opt
).libfuse2
(and curl
if needed).AppImage
file.AppImage
using --no-sandbox
.By following these steps, you will successfully install and configure Cursor AI IDE on your Ubuntu 24.04 system. This AI-powered tool will help improve your workflow and productivity in software development. Ensure you keep the software updated and explore its full capabilities to maximize its benefits.