Skip to content

Instantly share code, notes, and snippets.

@regularberry
Last active May 24, 2025 19:04
Show Gist options
  • Save regularberry/d60d4be1c0c31bc4fe4368fbe50233c5 to your computer and use it in GitHub Desktop.
Save regularberry/d60d4be1c0c31bc4fe4368fbe50233c5 to your computer and use it in GitHub Desktop.
Setup Script for OpenAI's codex to get SwiftLint running
#!/usr/bin/env bash
set -euxo pipefail
SWIFTLINT_VERSION="0.59.1"
ZIP_URL="https://github.com/realm/SwiftLint/releases/download/${SWIFTLINT_VERSION}/SwiftLintBinary.artifactbundle.zip"
curl -L -o /tmp/swiftlint.zip "$ZIP_URL"
unzip -q /tmp/swiftlint.zip -d /tmp/swiftlint_bundle
# choose the right variant for the host OS
case "$(uname -s)" in
Darwin*) VARIANT_DIR="swiftlint-0.59.1-macos" ;;
Linux*) VARIANT_DIR="swiftlint-0.59.1-linux-gnu" ;;
*) echo "❌ unsupported platform"; exit 1 ;;
esac
install -m 755 "/tmp/swiftlint_bundle/SwiftLintBinary.artifactbundle/${VARIANT_DIR}/bin/swiftlint" /usr/local/bin/swiftlint
rm -rf /tmp/swiftlint.zip /tmp/swiftlint_bundle
###
### Also set the ENV variable LINUX_SOURCEKIT_LIB_PATH to ~/.local/share/swiftly/toolchains/6.1.0/usr/lib
### Then in your AGENDS.md, tell it to run `swiftlint` after every commit to validate styling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment