Created
February 17, 2018 02:32
-
-
Save egregius313/df424b29e981f1cb5142b402f230f94e to your computer and use it in GitHub Desktop.
Script for setting up the proper GCC set up for CS 392 on macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script for setting up the proper GCC set up for CS 392 on macOS | |
# This script installs GCC version 6 | |
# Check for Homebrew and install it if not present | |
echo "Checking for brew" | |
if ! which brew | |
then | |
echo "Installing Homebrew" | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
fi | |
# Check if gcc-6 is present and install it if not | |
if ! which gcc-6 | |
then | |
echo "Installing GCC 6" | |
brew install gcc@6 | |
fi | |
# Add the alias to the shell to override the issues with clang | |
# Also rebinds g++ to avoid C++ issues in 492. | |
echo 'alias gcc="gcc-6"' >> .bash_profile | |
echo 'alias g++="g++-6"' >> .bash_profile | |
if [ -e ~/.zshrc ] | |
then | |
echo 'alias gcc="gcc-6"' >> .zshrc | |
echo 'alias g++="g++-6"' >> .zshrc | |
fi | |
# Alias it in the current shell anyway | |
alias gcc='gcc-6' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment