Here’s a simple quick tutorial on how to install Go Language from Google on the Mac OS X.
- Install XCode
- Install Macports
- Open Terminal and install mercurial from macports and wait.
sudo port install mercurial - 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 - Open a new Terminal to refresh the environment variables.
- Download the Go Language source codes
hg clone -r release https://go.googlecode.com/hg/ $GOROOT - Change directory to $GOROOT
cd $GOROOT/src - Build the source
./all.bash - If there are no errors it will show the following:
— cd ../test
N known bugs; 0 unexpected bugs - 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:
- Change directory to $GOROOT
cd $GOROOT/src - Update the source
hg update - Build the source
./all.bash - If there are no errors it will show the following:
— cd ../test
N known bugs; 0 unexpected bugs