Skip to content

Instantly share code, notes, and snippets.

@elfgzp
Created February 6, 2026 07:28
Show Gist options
  • Select an option

  • Save elfgzp/5ff04f0ceb127b4b6282c313d9d66795 to your computer and use it in GitHub Desktop.

Select an option

Save elfgzp/5ff04f0ceb127b4b6282c313d9d66795 to your computer and use it in GitHub Desktop.
CCS Installer v2.1 - Auto-detect architecture
#!/bin/bash
# CC-Switch (ccs) Installer v2
# Install to /usr/local/bin (requires sudo)
# One-liner: curl -fsSL https://gist.githubusercontent.com/elfgzp/GIST_ID/raw | sudo bash
set -e
INSTALL_DIR="/usr/local/bin"
REPO="saladday/cc-switch-cli"
echo "Installing cc-switch-cli to $INSTALL_DIR..."
# Check if running with sudo
if [ "$EUID" -ne 0 ]; then
echo "Please run with sudo: curl -fsSL ... | sudo bash"
exit 1
fi
# Detect architecture
ARCH=$(uname -m)
case $ARCH in
x86_64)
ARCH_SUFFIX="linux-x64-musl"
;;
aarch64|arm64)
ARCH_SUFFIX="linux-arm64-musl"
;;
*)
echo "Unsupported architecture: $ARCH"
exit 1
;;
esac
# Download latest release
echo "Fetching latest release for $ARCH_SUFFIX..."
LATEST_URL=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" | grep "browser_download_url.*$ARCH_SUFFIX" | head -1 | cut -d '"' -f 4)
if [ -z "$LATEST_URL" ]; then
echo "Error: Could not find release for architecture: $ARCH_SUFFIX"
exit 1
fi
echo "Downloading from: $LATEST_URL"
curl -fsSL "$LATEST_URL" -o /tmp/cc-switch.tar.gz
tar -xzf /tmp/cc-switch.tar.gz -C "$INSTALL_DIR"
chmod +x "$INSTALL_DIR/cc-switch"
echo "✓ cc-switch installed to $INSTALL_DIR"
# Download ccs wrapper
echo "Installing ccs wrapper..."
curl -fsSL "https://gist.githubusercontent.com/elfgzp/b81e8e4a063b65bae47134075acaf923/raw/ccs" -o "$INSTALL_DIR/ccs"
chmod +x "$INSTALL_DIR/ccs"
echo "✓ ccs installed to $INSTALL_DIR"
# Clean up
rm -f /tmp/cc-switch.tar.gz
echo ""
echo "✓ Installation complete!"
echo ""
echo "Usage:"
echo " ccs glm # Switch to Z.ai GLM-4.7"
echo " ccs kimi # Switch to Kimi Coding"
echo " ccs minimax # Switch to MiniMax M2.1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment