Tuesday, April 2, 2013

Upgrading gcc to gcc48 on MacOsX

This post describes how to update your gcc installation to gcc48 on MacOsX.

Dublin, but where? Main Street in Blackrock!

Short:

sudo port install gcc48 +universal

You can follow the instructions found here to update your installation of gcc. At the time of writing, gcc in version 4.8 is the current (experimental) version.

Be sure to change the default gcc command to the newly installed by issuing

sudo port select --set gcc mp-gcc48

and then, afterwards

hash gcc 

(to rehash it, see this link)

Test your gcc installation by issuing

gcc --version

which should give you an output like this.

gcc (MacPorts gcc48 4.8-20130328_0+universal) 4.8.1 20130328 (prerelease)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Your gcc installation on the command line should now be current.

7 comments:

  1. Thanks for this!
    -Matt

    ReplyDelete
  2. Thanks, this worked perfectly. I'm not sure if the +universal option is completely necessary though.

    ReplyDelete
    Replies
    1. It does seem to be necessary on Mavericks. Otherwise you get errors.

      Delete
  3. How many different things does this install? It got a bunch of differentthings (cctools, perl, etc) and seemed to take up multiple gb of space. Is this normal? I copy and pasted the first command.

    ReplyDelete
  4. Thanks very much for documenting this. Ideal and exactly what I was after.

    ReplyDelete
  5. I am receiving an error when I put the command
    sudo port -v selfupdate
    after installing Macport... please help

    ReplyDelete
  6. I am receiving an error when I put the command
    sudo port -v selfupdate
    after installing Macport... please help

    ReplyDelete