Skip to content

Instantly share code, notes, and snippets.

@Nyoho
Forked from jpmartha/get-swift-pkg
Last active April 13, 2016 03:37
Show Gist options
  • Save Nyoho/33828aeff9ed3e486646aa6a1871c12e to your computer and use it in GitHub Desktop.
Save Nyoho/33828aeff9ed3e486646aa6a1871c12e to your computer and use it in GitHub Desktop.
A Shell to download and install Swift Development Snapshots from Swift.org
#!/usr/bin/env bash
DEVELOPMENT_SNAPSHOTS_PATH=https://swift.org/builds/development/xcode
DEVELOPMENT_SNAPSHOTS_PREFIX=swift-DEVELOPMENT-SNAPSHOT-
echo
if [ -z "$1" ]; then
echo "OVERVIEW: Download and install Swift Development Snapshots from Swift.org."
echo
echo "USAGE: get-swift-pkg [development-snapshots-name]"
echo
echo "Example: get-swift-pkg 2016-03-24-a"
echo
echo "Available development-snapshots-names are ..."
curl -s https://swift.org/download/|grep xcode/swift-DEVELOPMENT-SNAPSHOT | sed -n 's/^.*href="\/builds\/development\/xcode\/swift-DEVELOPMENT-SNAPSHOT-\([^"]*\)\/.*".*$/\1/p' | uniq
exit 1
fi
DEVELOPMENT_SNAPSHOTS_NAME=$DEVELOPMENT_SNAPSHOTS_PREFIX"$1"
curl -O\# $DEVELOPMENT_SNAPSHOTS_PATH/$DEVELOPMENT_SNAPSHOTS_NAME/$DEVELOPMENT_SNAPSHOTS_NAME-osx.pkg
sudo installer -pkg $DEVELOPMENT_SNAPSHOTS_NAME-osx.pkg -target /
rm $DEVELOPMENT_SNAPSHOTS_NAME-osx.pkg
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment