Prep for Parallella's 64 Cores: Installing Go on Mac OS X

Parallella 64-core supercomputer

The idea of owning a 64-core parallel system for two hundred dollars (yes, $200.00) is exciting. Parallella is working to make that happen, perhaps as early as August 2013. To prepare for that day, I’ve decided to introduce myself to the Go language.

What is Go?

The Go language is designed for parallel systems. Why does Go exist? One developer sums it up this way:

Go was created at Google, by Google, for Google-size problems.
~Dave Astels

Google writes software that runs on thousands of machines in parallel. As the number of concurrent operations increases, new challenges are encountered. Google addressed those challenges by creating Go.

Why Does a Rubyist Learn Go?

The team at WisdomGroup writes web and mobile apps, mainly in Ruby. So why am I learning Go?

Because the best developers are polyglot. When we learn a new language, we cause ourselves to see old problems in new ways and we strengthen our ability to solve new problems. It’s like cross-training for athletes. In the end, we become better developers.

How to Install Go on Mac OS X

$ rm -rf /usr/local/go

export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
export GOPATH=~/Code/gocode

$ source ~/.bash_profile

Now, let’s Go for a test drive.

Creating a Go Workspace

Before you can run a Go program on your system, you have to create a Go workspace. A workspace is a directory structure that contains source code and binaries that a Go program needs in order to compile and execute.

We can examine the Go Workspace on my system with the Unix tree command:

~/Code/gocode$ tree
└── src
        └── rayhightower
            └── hello
                └── hello.go

4 directories, 1 file


Here’s a brief description of the directories:

All structure below the gocode directory is mandated by Go.

Writing ‘Hello World!’ in Go

Google’s official installation instructions include a simple ‘Hello World’ program for testing the installation. A slightly modified version appears below:

package main

import "fmt"

func main() {
    fmt.Printf("\n** Hey Parallella enthusiasts: Learn Go! **\n")

Compiling and Running

We drop the code into a file called hello.go in the hello directory. To compile the program:

~/Code/gocode/src/$ go install


If the Go compiler responds with a blank prompt (like above) then the program compiled successfully and a bin directory has been created inside the Go workspace. Run the tree command from the gocode directory to see how the structure has changed:

~/Code/gocode$ tree
├── bin
│   └── hello
└── src
        └── rayhightower
            └── hello
                └── hello.go

5 directories, 2 files


The newly created bin/ directory contains our hello executable. And now, let’s cut the suspense and run the program. To do so, change into the bin/ directory and type ./hello.

~/Code/gocode/src/$ cd ~/Code/gocode/bin

~/Code/gocode/bin$ ./hello

** Hey Parallella enthusiasts: Learn Go! **



It’s Not Official, But It Makes Sense

As of this writing, Parallella does not officially support the Go language. So why go through all of this trouble? Because…

The Go-Parallella match makes sense. It’s always good to skate where the puck is going.

Next Steps

Now it’s time to explore the Go language. The real adventure begins when the 64-core Parallella arrives. Looking forward to it!


I was inspired to explore Go by Blake Smith’s presentation at 8th Light. Justin Love introduced me to Parallella last month at ChicagoRuby.