Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

64 lines (49 sloc) 1.34 KB
#! /bin/bash
# This shell script can be used to install the GNU gcc compiler on an
# OS X computer. The GNU gcc compiler is usually better at compiling
# C code produced by the Gambit Scheme compiler than the clang (LLVM)
# compiler which is provided with Apple's Xcode.
# After executing:
# ./install-gnu-gcc-osx
# you should add this line to your ~/.profile and ~/.bashrc files:
# export PATH=/usr/gcc-4.7.1/bin:$PATH
# The shell script assumes that the homebrew system (see
# http:// and Xcode have been
# installed.
MAKE="make -j 4"
brew_path() { brew info $1 | head -n3 | tail -n1 | cut -d' ' -f1; }
# Prerequisites
brew install gmp
brew install mpfr
brew install libmpc
# Download & install the latest GCC
mkdir -p $PREFIX
mkdir temp-gcc
cd temp-gcc
tar xfz gcc-$VERSION.tar.gz
rm gcc-$VERSION.tar.gz
cd gcc-$VERSION
mkdir build
cd build
../configure \
--prefix=$PREFIX \
--with-gmp=$(brew_path gmp) \
--with-mpfr=$(brew_path mpfr) \
--with-mpc=$(brew_path libmpc) \
--enable-languages=$LANGUAGES \
--with-system-zlib \
--enable-stage1-checking \
--enable-plugin \
--enable-lto \
$MAKE bootstrap
sudo make install
cd ../../..
rm -r temp-gcc
Jump to Line
Something went wrong with that request. Please try again.