-
-
Save arthurmde/14c035ec002aa8e0bd41493168408615 to your computer and use it in GitHub Desktop.
install-cursor.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# To install on ubuntu | |
# curl -fsSL https://gist.github.com/tatosjb/0ca8551406499d52d449936964e9c1d6/raw/28459ee07900ef76081c9e276cd94d707bed73a9/install-cursor-sh | bash | |
installCursor() { | |
if ! [ -f /opt/cursor.appimage ]; then | |
echo "Installing Cursor AI IDE..." | |
mkdir -p "$HOME/Applications/cursor" | |
# URLs for Cursor AppImage and Icon | |
APPIMAGE_URL="$(curl -s "https://www.cursor.com/api/download?platform=linux-x64&releaseTrack=stable" | jq -r '.downloadUrl')" | |
ICON_URL="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTO4H5JRdhQKQH6T8DzUgKSUeiqz-R91qHY02wn7f-gjmzKmn_uiivgTNb-hhaBY3Is9lQ&usqp=CAU" | |
# Paths for installation | |
APPDIR="$HOME/Applications/cursor" | |
APPIMAGE_PATH="$APPDIR/cursor.AppImage" | |
TEMP_DOWNLOAD="$APPDIR/cursor.AppImage.tmp" | |
ICON_PATH="$APPDIR/cursor-icon.png" | |
DESKTOP_ENTRY_PATH="/usr/share/applications/cursor.desktop" | |
# Install curl if not installed | |
echo "curl is not installed. Installing..." | |
sudo apt-get update | |
sudo apt-get install -y wget dbus-x11 update-notifier | |
# Download Cursor AppImage | |
echo "Downloading Cursor AppImage..." | |
wget -O $APPIMAGE_PATH "$APPIMAGE_URL" | |
sudo chmod +x $APPIMAGE_PATH | |
echo "" >> $APPDIR | |
bash -c "cat > $APPDIR/cursor-wrapper" <<EOL | |
#!/bin/bash | |
$APPIMAGE_PATH --no-sandbox "\$@" | |
EOL | |
sudo chmod +x $APPIMAGE_PATH | |
sudo bash -c "cat > /usr/local/bin/cursor" <<EOL | |
#!/bin/bash | |
nohup $APPIMAGE_PATH --no-sandbox "\$@" >/dev/null 2>&1 < /dev/null & | |
EOL | |
sudo chmod +x /usr/local/bin/cursor | |
# Download Cursor icon | |
echo "Downloading Cursor icon..." | |
wget -O $ICON_PATH "$ICON_URL" | |
# Create a .desktop entry for Cursor | |
echo "Creating .desktop entry for Cursor..." | |
sudo bash -c "cat > $DESKTOP_ENTRY_PATH" <<EOL | |
[Desktop Entry] | |
Name=Cursor | |
Exec=$APPIMAGE_PATH --no-sandbox | |
Icon=$ICON_PATH | |
Type=Application | |
Categories=Utility;Development; | |
EOL | |
eval $(dbus-launch --sh-syntax) | |
echo "export XDG_RUNTIME_DIR=\"/run/user/\$(id -u)\"" >> $HOME/.zshrc | |
echo "export DBUS_SESSION_BUS_ADDRESS=\"unix:path=\${XDG_RUNTIME_DIR}/bus\"" >> $HOME/.zshrc | |
echo " | |
Cursor AI IDE installation complete. You can find it in your application menu. | |
PLEASE REBOOT YOUR SYSTEM TO MAKE SURE THAT EVERYTHING WAS SET UP PROPERLY | |
" | |
else | |
echo "Cursor AI IDE is already installed." | |
fi | |
} | |
installCursor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment