Setting up Go on OS X

Setting up Go on OS X involves several steps.

Install Go using Homebrew

~# brew update
~# brew install go

 

Install Eclipse. I prefer Eclipse for Java Developers.

Install GoClipse from the update site:

http://goclipse.googlecode.com/svn/trunk/goclipse-update-site
 

  1. Install gdb:
    1. Download gdb source file: http://www.gnu.org/software/gdb/download/
    2. Uncompress.
    3. In Terminal;
      ~# cd ~/Downloads/gdb-x.x
      ~# ./configure
      ~# make
      ~# sudo make install
      ~# gdb --version (check version)
      ~# which gdb (check where it is installed)
  2. Create a go directory to house your personal go binary installs and sources for bash support. In a Terminal:
    
    ~# mkdir go
    ~# cd go
  3. Update ~/.profile:

    export GOPATH=/Users/rmunn/go
    export GOBIN=$GOPATH/bin
    export PATH=/usr/local/bin:$PATH:/usr/local/Cellar/go/1.2.1/libexec/bin
  4. Install gocode:

    ~# go get github.com/nsf/gocode
     

  5. Install Mercurial if you don't have it:

    ~# brew install hg
     
  6. Install godoc and govet:

    ~#  go get code.google.com/p/go.tools/cmd/godoc
    ~# go get code.google.com/p/go.tools/cmd/vet
     
  7. Configure the Go Preferences in Eclipse

If you run into problems along the way, most likely $GOPATH or $GOBIN are not set correctly, or the proper tools are not installed (e.g. Mercurial). Check the Web for solutions to particular errors.