Go To It Mac OS

broken image


Once that's done and dusted, you must now install the latest VMware Tools onto the newly created OS X VM. There's a possibility that it had caught your eye when we ran win-update-tools.cmd for OS X Unlocker. Right click on the Mac OS X 10.9 VM on the left side and go to Settings. Go to CD/DVD and go to Browse and mount the darwin.iso file. I installed Go 1.4 in Mac OS X. Previously I had Go 1.0. I set the GOROOT and PATH as follows, Dineshs-MacBook-Air:go-cassandra Dany$ which go /usr/local/go/bin/go Dineshs-MacBook-Air:go-cassandra. Explore the world of Mac. Check out MacBook Pro, MacBook Air, iMac, Mac mini, and more. Visit the Apple site to learn, buy, and get support. For earlier versions of Mac OS X, including Mac OS X Mavericks 10.9, Mac OS X Mountain Lion 10.8, Mac OS X Lion 10.7, Mac OS X Snow Leopard 10.6, Mac OS X Leopard 10.5, Mac OS X Tiger 10.4, and before, the process to obtain those installers differs a bit. Downloading Mac OS X Installers from App Store 'Purchases'. The history of macOS, Apple's current Mac operating system originally named Mac OS X until 2012 and then OS X until 2016, began with the company's project to replace its 'classic' Mac OS.That system, up to and including its final release Mac OS 9, was a direct descendant of the operating system Apple had used in its Macintosh computers since their introduction in 1984.

It's very easy to install Go on Mac OS. Let's get started.

1. Download Go Mac OS Installer Package

Go to the GoLang download page: https://golang.org/dl/ and download the Mac OS installer package.

2. Run the Installer Package to Install Go on Mac

Open the Mac OS installer package and follow the steps. There are no configurations and options to choose from, so it's a straight forward installation.

3. Verifying Go Installation by checking its version

Launch the terminal and run the go version command and it should print the GoLang version.

Congratulations! GoLang has been successfully installed on your Mac OS.

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

Installation

You can follow the official instructions on how to install Go, or you can use Homebrew instead:

When installed, run go version to see the installed version of Go.

Setup your workspace

The GOPATH and PATH environment variables

The GOPATH environment variable specifies the location of your workspace. It defaults to a directory named go inside your home directory ($HOME/go).

If you really want to change your GOPATH to something else add GOPATH to your shell/bash/zsh initialization file .bash_profile, .bashrc or .zshrc.

Add GOPATH/bin directory to your PATH environment variable so you can run Go programs anywhere.

Make sure to re-source source .bash_profile your current session or simply open new tab within iTerm.

Write your first program

Mac

Create a file in your workspace $GOPATH/src/hello/main.go and add some code, for example:

Run the program by running:

If you wish to compile it and move it to $GOPATH/bin, then run:

Since you have $GOPATH/bin added to your $PATH, you can run your program from anywhere:

Import a Go package

Besides creating your own packages you can import and use other packages in your Go code. To do so you'll use the go get command:

The command above will import the package mux into this directory $GOPATH/src/github.com/gorilla/mux.

You can then use this package in your Go programs like this:

Tooling and learning

Format your code

Go has a built-in tool that automatically formats Go source code.

To format a single file run:

You can also format an entire package:

Note: that the command is different from formatting a single file

Generate documentation

With the godoc command you can generate documentation from your code and read documentation from other packages.

You need to respect some spec in order to document using godoc. More information in the Godoc documentation.

Learn more

Mac Os To Go

The interactive tutorial will let you learn more about Go. You can also install it locally by go get golang.org/x/tour and running it anywhere by tour (given that you added GOPATH/bin to your PATH).





broken image