Skip to content

Instantly share code, notes, and snippets.

@jpmartha
Created April 10, 2016 07:53
Show Gist options
  • Save jpmartha/069ad1fa74a0ad3bd745d996311a7c74 to your computer and use it in GitHub Desktop.
Save jpmartha/069ad1fa74a0ad3bd745d996311a7c74 to your computer and use it in GitHub Desktop.
Managing Swift Environments
#!/bin/bash
echo
echo "Before the change:"
xcrun --find swift
swift --version
echo
if [[ $PATH =~ /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:* ]]
then
echo "You have already set the PATH."
else
export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:$PATH
echo "PATH="$PATH
fi
if [[ $TOOLCHAINS = swift ]]
then
echo "You have already set the TOOLCHAINS."
else
export TOOLCHAINS=swift
echo "TOOLCHAINS="$TOOLCHAINS
fi
echo
echo "After the change:"
xcrun --find swift
swift --version
echo
@stewiebig69
Copy link

export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:$PATH

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