For those of us who love to compile their Arduino code from the command line, I've created a tap to easily install the AVR Toolchain.

Both avr-gcc 4.8 and avr-gcc 4.9 are provided.

Here is the link to the repo:

weareleka/homebre-avr

Installing the toolchain

To install the toolchain, is really easy:

# First tap the repository
$ brew tap WeAreLeka/avr

# Then to install the latest version of avr-gcc
$ brew install avr-libc

# or to install previous versions of avr-gcc
$ brew install avr-libcXX

# where XX is the version you want to install, eg. 4.8.3
$ brew install avr-libc48

Switching between versions

It is possible to have multiple versions of the AVR Toolchain installed side by side. But they cannot be used at the same time.

To switch between version, for example from 4.9 to 4.8 you need to:

# First unlink the current 4.9 version
$ brew unlink avr-gcc avr-libc

# Then link the 4.8 version
$ brew link avr-gcc48 avr-libc48

And to switch from an older version to the latest version:

# Unlink the current version where XX is the version number
$ brew unlink avr-gccXX avr-libcXX

# Then link the latest version
$ brew link avr-gcc avr-libc

Hope it helps! :)