Dec 022009
 

Here’s a simple quick tutorial on how to install Go Language from Google on the Mac OS X.

  1. Install XCode
  2. Install Macports
  3. Open Terminal and install mercurial from macports and wait.
    sudo port install mercurial
  4. Edit your .profile to include the Go environment variables. This is required to build the Go Language. Add the following:
    # wherever your Go source directory will be
    export GOROOT=$HOME/go
    # or 386 but it is recommended to use amd64
    export GOARCH=amd64
    export GOOS=darwin
    # export GOBIN=$HOME/bin # it will install the Go compiler here by default.
    # add the $GOBIN into your path environment if you want to.
    # export PATH=$GOBIN:$PATH
  5. Open a new Terminal to refresh the environment variables.
  6. Download the Go Language source codes
    hg clone -r release https://go.googlecode.com/hg/ $GOROOT
  7. Change directory to $GOROOT
    cd $GOROOT/src
  8. Build the source
    ./all.bash
  9. If there are no errors it will show the following:
    — cd ../test
    N known bugs; 0 unexpected bugs
  10. You can start using it now! 6g is the compiler filename for amd64 and 8g is the compiler filename for 386.

To update the source:

  1. Change directory to $GOROOT
    cd $GOROOT/src
  2. Update the source
    hg update
  3. Build the source
    ./all.bash
  4. If there are no errors it will show the following:
    — cd ../test
    N known bugs; 0 unexpected bugs