Skip to content

Instantly share code, notes, and snippets.

@naranyala
Created August 3, 2025 04:19
Show Gist options
  • Select an option

  • Save naranyala/532f238aeb1a2ab3dbb605d7293a877c to your computer and use it in GitHub Desktop.

Select an option

Save naranyala/532f238aeb1a2ab3dbb605d7293a877c to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -euo pipefail
# 🧰 Configuration
ARCH="$(uname -m)"
SWIFTLY_URL="https://download.swift.org/swiftly/linux/swiftly-${ARCH}.tar.gz"
SWIFTLY_TAR="swiftly-${ARCH}.tar.gz"
SWIFTLY_DIR="${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}"
# πŸ“₯ Download the Swiftly archive
echo "Downloading Swiftly for architecture: $ARCH"
curl -fsSL -o "$SWIFTLY_TAR" "$SWIFTLY_URL"
# πŸ“¦ Extract the archive
echo "Extracting archive..."
tar zxf "$SWIFTLY_TAR"
# βš™οΈ Initialize Swiftly
echo "Initializing Swiftly..."
./swiftly init --quiet-shell-followup
# πŸ§ͺ Load environment
echo "Sourcing environment script..."
if [ -f "$SWIFTLY_DIR/env.sh" ]; then
. "$SWIFTLY_DIR/env.sh"
else
echo "❌ Failed to find env.sh in $SWIFTLY_DIR"
exit 1
fi
# πŸ”„ Refresh shell cache
echo "Refreshing command cache..."
hash -r
echo "βœ… Swiftly setup complete!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment