Skip to content

Instantly share code, notes, and snippets.

@bryjbrown
Created October 3, 2014 15:06
Show Gist options
  • Save bryjbrown/8dfb958b10f30506b121 to your computer and use it in GitHub Desktop.
Save bryjbrown/8dfb958b10f30506b121 to your computer and use it in GitHub Desktop.
Idiot-proof Anaconda installation script for Mac/Linux
#!/usr/bin/env bash
# Get correct installer script and config file for OS
KERNAL=$(uname)
if [ $KERNAL = "Darwin" ]; then
URL="http://repo.continuum.io/anaconda3/Anaconda3-2.1.0-MacOSX-x86_64.sh"
CONFIG=".profile"
elif [ $KERNAL = "Linux" ]; then
URL="http://repo.continuum.io/anaconda3/Anaconda3-2.1.0-Linux-x86_64.sh"
CONFIG=".bashrc"
else
echo "OS unknown, aborting installation."
exit
fi
# Download, run, and clean up installer script
wget -O ~/anaconda-installer.sh $URL
bash ~/anaconda-installer.sh -b -p ~/anaconda3
rm ~/anaconda-installer.sh
# Enable Anaconda and add to path from within config file
chmod -R 777 ~/anaconda3
echo 'export PATH=~/anaconda3/bin:$PATH' >> ~/${CONFIG}
source ~/${CONFIG}
echo "Anaconda3 has been successfully installed to ~/anaconda3."
echo "This version will override all other versions of Python on your system."
echo "Your ~/${CONFIG} file has been modified to add Anaconda 3 to your PATH variable."
echo "For more info about Anaconda, see http://docs.continuum.io/anaconda/index.html"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment