Installing the GNU AVR Toolchain on Mac OS X Snow Leopard
Update: Updated the article to use nice new syntax highlighting.
Before you start you must already have the Apple Developer Tools installed. The latest version of which can be downloaded from the Mac Developer Centre (registration required).
GNU Binutils:
cd binutils-folder mkdir obj-avr cd obj-avr ../configure --prefix=CHANGE_TO_ABSOLUTE_INSTALL_PATH --program-prefix=avr- --target=avr --disable-nls --disable-werror --enable-install-libbfd make make install
GCC:
Make sure to download MPFR, MPC and GMP first and place then in folders (with the same name and in lower case) in the root of the GCC source directory. They will automatically be compiled along with GCC itself.
If you make use of MPFR 3.0.0 there is a patch that you need to install before you compile GCC. Download it here. Save it as allpatches.txt and then simply use the following command (assuming you are in the gcc directory) to apply it:
patch -N -Z -p1 > ../allpatches.txt
Once that patch has been applied you now need to patch GCC itself with this patch. Unfortunately you need to insert the missing commas in the middle column, it should be straight forward to see what I mean when you open the patch file up in a text editor. Apply the patch like so (again assuming you are in the gcc directory):
patch -p0 < ../changes.patch.txt
At this point you are now ready to start the compilation and installation of the AVR GCC compiler:
cd gcc-folder mkdir obj-avr cd obj-avr ../configure --prefix=CHANGE_TO_ABSOLUTE_INSTALL_PATH --program-prefix=avr- --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp --with-dwarf2 --disable-werror make make install
GDB:
cd gdb-folder mkdir obj-avr cd obj-avr ../configure --prefix=CHANGE_TO_ABSOLUTE_INSTALL_PATH --target=avr --program-prefix=avr- make make install
AVaRICE:
cd avarice-folder mkdir obj-avr cd obj-avr $CPPFLAGS=-ICHANGE_TO_ABSOLUTE_INSTALL_PATH/i386-apple-darwin10.3.0/avr/include LDFLAGS="-LPATH_TO_LIBBFD -LPATH_TO_LIBIBERTY" ../configure --prefix=CHANGE_TO_ABSOLUTE_INSTALL_PATH make make install
References:
Building and Installing the GNU Toolchain
Although my original article predates the following article I came back and updated my article using some of the information contained in the articled linked below when I upgraded my tool chain so I include a link here just to mention it.