Skip to content

Instantly share code, notes, and snippets.

@egregius313
Created February 17, 2018 02:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save egregius313/df424b29e981f1cb5142b402f230f94e to your computer and use it in GitHub Desktop.
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
#!/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