Install gcc

From AwkwardTV
Revision as of 12:45, 31 July 2010 by Fcorthay (talk | contribs) (Install the binaries)
Jump to: navigation, search

Installing gcc is simple: you just need to have a working gcc and compile the sources...


A compiled version of gcc is provided by SourceForge's High Performance Scientific Computation on Mac OS X project.

We'll also need some binaries from an Intel Mac with Tiger and Xcode tools install.

Prepare the install

The files will be installed in /usr/local/. In order not to take too much space in the smaller OSBoot partition, we'll have this directory on the Media partition.

Log into the AppleTV as root and create the directory:

mkdir /mnt/Scratch/local

If you already have a /usr/local/ directory, move it:

cp -R /usr/local/* /mnt/Scratch/local/
rm -R /usr/local

Now make a link to it:

ln -s /mnt/Scratch/local /usr/local

Install the binaries

Navigate to the directory where you downloaded gcc-intel-bin.tar.gz and uncompress it:

tar -xvzpf gcc-intel-bin.tar.gz -C /

Make a link to gcc:

ln -s /usr/local/bin/gcc /usr/bin/cc

Test it:

cc -v

From an Intel Mac with Tiger with Xcode tools installed, copy to the following files to AppleTV:


From the same Mac, copy the directory /usr/include to the AppleTV's /usr/local/include.

Optional files to copy:



ln -s /usr/bin/libtool /usr/bin/ranlib

Test a first compilation:

echo 'int main () { return 0; }' > /tmp/test.c
cc /tmp/test.c