This response is probably too late for you, but it may help other people coming here for help. I know it certainly would have helped me out a few days ago ;)
As indicated above, recent versions of OSX use a new compiler called clang, and the gcc command is set up to use this instead. cheeky apple. It is possible to install gcc alongside it however. Both Homebrew & MacPorts offer packages, but I found that Homebrew seemed to get in some permanent loop whilst installing, so I ended up using MacPorts which you can install from http://www.macports.org/
With MacPorts installed from that site, first you need to install the correct version of gcc. Currently they’re at 4.9 but neither the sample code or the CppUTest source will compile with that. Through trial & error (mosely error) I found that 4.6 works. In a terminal session type
“sudo port install gcc46”
This’ll set up gcc on your machine, however, gcc will still be pointing to clang. Macports then lets us choose between different versions of installed software. Typing
“port select –list gcc”
will show you the different versions installed. When it is set to “none” it’ll default to using clang as before, but you can set it to whichever other versions you have installed thusly
“sudo port select –set gcc mp-gcc46”
changing that mp-gcc46 bit at the end to other installed versions or back to none will set gcc to point at them, so you can flip around different compilers based on what you’re working on.
After running this command you’ll need to exit terminal and reopen it for it all to get pointed in the right direction. Whereupon
should happily start reporting that v4.6 is installed. That got both the book code and the CppUTest source to compile correctly for me.