Skip to content

Instantly share code, notes, and snippets.

@flyemsafe
Created February 17, 2025 19:53
Show Gist options
  • Save flyemsafe/085a62610ac0bba2fc2cf26dee1941ef to your computer and use it in GitHub Desktop.
Save flyemsafe/085a62610ac0bba2fc2cf26dee1941ef to your computer and use it in GitHub Desktop.
Windsurf Installation on Fedora or RHEL
#!/usr/bin/env bash
#
# INSTALL_Windsurf.sh
#
# Description:
# This script installs the Windsurf application under /opt, sets up a GNOME
# application launcher, and registers a custom icon for easy access.
#
# MANUAL STEPS BEFORE RUNNING THIS SCRIPT:
# 1. Visit the Windsurf website and download the tar.gz archive for Linux
# (e.g., Windsurf-linux-x64-1.3.4.tar.gz) to your ~/Downloads folder.
# 2. If the tar.gz extracts to a directory name other than "Windsurf",
# update the script's 'cp' command accordingly.
#
# Usage:
# chmod +x install_windsurf.sh
# ./install_windsurf.sh
#
# Notes:
# - Adjust paths or filenames below if your download location or archive name differs.
# - This script assumes you want to install for all users; thus, it uses 'sudo'
# for certain steps.
set -e
WINDSURF_ARCHIVE="$HOME/Downloads/Windsurf-linux-x64-1.3.4.tar.gz"
INSTALL_PATH="/opt/windsurf"
DESKTOP_FILE="/usr/share/applications/windsurf.desktop"
ICON_SOURCE="$INSTALL_PATH/resources/app/out/vs/workbench/contrib/windsurfCustomAppIcon/browser/media/classic/classic-dock.png"
ICON_TARGET="/usr/share/icons/hicolor/48x48/apps/windsurf.png"
echo "*****************************************************"
echo "Windsurf Installation Script"
echo "*****************************************************"
echo
echo "Ensure you have downloaded the Windsurf tar.gz from the official site."
echo "Expected file at: $WINDSURF_ARCHIVE"
echo
read -rp "Press Enter to continue or Ctrl+C to abort..."
# 1. Extract tar.gz to /tmp
echo "Extracting $WINDSURF_ARCHIVE to /tmp..."
cd /tmp
tar xf "$WINDSURF_ARCHIVE"
# 2. Move extracted folder to /opt
# If the extracted directory name is different, e.g., "Windsurf-1.3.4",
# adjust the path below.
echo "Moving Windsurf to $INSTALL_PATH..."
sudo mkdir -p "$INSTALL_PATH"
sudo cp -r Windsurf/* "$INSTALL_PATH"
# 3. Adjust permissions
echo "Setting permissions on $INSTALL_PATH..."
sudo chmod -R 755 "$INSTALL_PATH"
# 4. Create a symlink for windsurf
echo "Linking windsurf executable to /usr/local/bin..."
if [ -f "/usr/local/bin/windsurf" ]; then
sudo rm /usr/local/bin/windsurf
fi
sudo ln -s "$INSTALL_PATH/windsurf" /usr/local/bin/windsurf
# 5. Copy the icon to the system icons directory
echo "Copying custom icon to /usr/share/icons/hicolor/48x48/apps..."
sudo mkdir -p "$(dirname "$ICON_TARGET")"
sudo cp "$ICON_SOURCE" "$ICON_TARGET"
# 6. Update the icon cache
echo "Updating icon cache..."
sudo gtk-update-icon-cache /usr/share/icons/hicolor
# 7. Create a .desktop file so GNOME can launch Windsurf
echo "Creating $DESKTOP_FILE..."
sudo bash -c "cat > $DESKTOP_FILE" <<EOF
[Desktop Entry]
Version=1.0
Type=Application
Name=Windsurf
Comment=Launch the Windsurf application
Exec=$INSTALL_PATH/windsurf
Icon=windsurf
Terminal=false
Categories=Utility;
EOF
echo "*****************************************************"
echo "Installation Complete!"
echo "You can now launch Windsurf from your GNOME Applications menu."
echo "*****************************************************"
@Akiyamka
Copy link

Akiyamka commented Mar 19, 2025

Updated version with self download

set -e

echo "*****************************************************"
echo "Windsurf Installation Script"
echo "*****************************************************"
echo
echo "This script willdownload and install latest version of Windsurf"
echo
read -rp "Press Enter to continue or Ctrl+C to abort..."

LATEST=$(curl https://windsurf-stable.codeium.com/api/update/linux-x64/stable/latest | jq -r .url)
WINDSURF_ARCHIVE=./latest.tar.gz
echo $LATEST
wget $LATEST -O "$WINDSURF_ARCHIVE"
INSTALL_PATH="/opt/windsurf"
DESKTOP_FILE="/usr/share/applications/windsurf.desktop"
ICON_SOURCE="$INSTALL_PATH/resources/app/out/vs/workbench/contrib/windsurfCustomAppIcon/browser/media/classic/classic-dock.png"
ICON_TARGET="/usr/share/icons/hicolor/48x48/apps/windsurf.png"

# 1. Extract tar.gz to /tmp
echo "Extracting $WINDSURF_ARCHIVE to /tmp..."
mv "$WINDSURF_ARCHIVE" /tmp
cd /tmp
tar xf "$WINDSURF_ARCHIVE"

# 2. Move extracted folder to /opt
#    If the extracted directory name is different, e.g., "Windsurf-1.3.4",
#    adjust the path below.
echo "Moving Windsurf to $INSTALL_PATH..."
sudo mkdir -p "$INSTALL_PATH"
sudo cp -r Windsurf/* "$INSTALL_PATH"

# 3. Adjust permissions
echo "Setting permissions on $INSTALL_PATH..."
sudo chmod -R 755 "$INSTALL_PATH"

# 4. Create a symlink for windsurf
echo "Linking windsurf executable to /usr/local/bin..."
if [ -f "/usr/local/bin/windsurf" ]; then
  sudo rm /usr/local/bin/windsurf
fi
sudo ln -s "$INSTALL_PATH/windsurf" /usr/local/bin/windsurf

# 5. Copy the icon to the system icons directory
echo "Copying custom icon to /usr/share/icons/hicolor/48x48/apps..."
sudo mkdir -p "$(dirname "$ICON_TARGET")"
sudo cp "$ICON_SOURCE" "$ICON_TARGET"

# 6. Update the icon cache
echo "Updating icon cache..."
sudo gtk-update-icon-cache /usr/share/icons/hicolor

# 7. Create a .desktop file so GNOME can launch Windsurf
echo "Creating $DESKTOP_FILE..."
sudo bash -c "cat > $DESKTOP_FILE" <<EOF
[Desktop Entry]
Version=1.0
Type=Application
Name=Windsurf
Comment=Launch the Windsurf application
Exec=$INSTALL_PATH/windsurf
Icon=windsurf
Terminal=false
Categories=Utility;
EOF

rm ${WINDSURF_ARCHIVE}
echo "*****************************************************"
echo "Installation Complete!"
echo "You can now launch Windsurf from your GNOME Applications menu."
echo "*****************************************************"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment