# Installing Go, Gocode, GDB and LiteIDE

- Published: June 2, 2013
- Author: William Kennedy
- URL: https://www.ardanlabs.com/blog/2013/06/installing-go-gocode-gdb-and-liteide.html

Check out my new installtion document:<br />
<a href="https://www.ardanlabs.com/blog/2016/05/installing-go-and-your-workspace.html" target="_blank"><span class="sr-only">External resource on ardanlabs.com: </span>https&#58;//www.ardanlabs.com/blog/2016/05/installing-go-and-your-workspace.html</a><br />
<br />

<i>I removed the sections about gocode and GDB. These are not necessary any longer. I also added links for more editors.</i><br />
<br />

<span style="font-size: x-large;"><b>Windows</b></span><br />
This is a great post by <a href="https://twitter.com/WadeWegner" target="_blank">Wade Wegner</a> for installing Go on your Windows Machine:<br />
<a href="http://www.wadewegner.com/2014/12/easy-go-programming-setup-for-windows/" target="_blank"><span class="sr-only">External resource on wadewegner.com: </span>http&#58;//www.wadewegner.com/2014/12/easy-go-programming-setup-for-windows/</a><br />
<br />
<h3>
<span style="font-size: x-large;">Mac OS X</span><span style="font-size: small; font-weight: normal;"><br />The following instructions will guide you through installing Go on your Mac.</span></h3>
<div style="text-align: justify;">
<h3>
<b><br />Step 1: Download Go</b></h3>
</div>
Open your favorite browser and go to the following website:<br />
<a href="http://golang.org/dl/" target="_blank"><span class="sr-only">External resource on golang.org: </span>http&#58;//golang.org/dl/</a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="margin:0 auto; display:block; width:640px;">
![Screen Shot](../../../images/goinggo/Screen+Shot+2015-08-29+at+8.57.08+PM.png)
</div>

<br />
This will show you all the latest builds for the different operating systems. Darwin is the name for the Mac OS. Download the installer package for your OS version and architecture.<br />
<br />
Once downloaded go to your Downloads folder in Finder and double click on the pkg file to start the installation. The installation will put Go in <b><i>/usr/local/go</i></b>. Once the installation is complete you will want to check the installation.<br />
<br />
<i>Note: Moving forward we will be using both Terminal and Finder. It helps to be able to see all the files in Finder. &nbsp;Finder by default will not show you everything that is on your hard drive.</i><br />
<i><br /></i>
<b><i>To show all files in Finder:</i></b><br />
<br />
Open a Terminal session.&nbsp;If you don't know where the Terminal program is go to your Applications folder in Finder and then Utilities. Click on Terminal and a bash shell command window will open.<br />
<br />
Execute the following commands in Terminal.<br />
<br />
<div style="background-color: #666666; color: #cccccc; padding: 5px;">
defaults write com.apple.finder AppleShowAllFiles TRUE<br />
killall Finder</div>
<br />
The <b><i>killall Finder</i></b> will reload the Finder program and now you can see all the files.<br />
<h3>
<b><br />Step 2: &nbsp;Check Installation</b></h3>
Open a Terminal session and type the following command<br />
<br />
<div style="background-color: #666666; color: #cccccc; padding: 5px;">
go version</div>
<br />
You should see the following if everything installed correctly<br />
<br />
<div style="background-color: #666666; color: #cccccc; padding: 5px;">
go version go1.5 darwin/amd64</div>
<br />
Now type the <b><i>which</i></b> command to verify the installation is in <b><i>/usr/local/go</i></b><br />
<br />
<div style="background-color: #666666; color: #cccccc; padding: 5px;">
which go</div>
<br />
You should see that Go can be found in <b><i>/usr/local/go/bin</i></b><br />
<br />
<div style="background-color: #666666; color: #cccccc; padding: 5px;">
/usr/local/go/bin/go</div>
<h3>
<b><br />Step 3: &nbsp;Set Your GOPATH</b></h3>
You need a single place to store and work on your Go projects. Create a folder called projects from inside your home folder:
<br />
<br />
<div>
<div style="background-color: #666666; color: #cccccc; padding: 5px;">
cd $HOME</div>
<br />
<div style="background-color: #666666; color: #cccccc; padding: 5px;">
mkdir projects<br />
cd projects<br />
mkdir src<br />
mkdir bin</div>
<br />
Now set projects as your GOPATH. Open the .bash_profile file from the $HOME folder and add the following items to the end.<br />
<br />
<div style="background-color: #666666; color: #cccccc; padding: 5px;">
nano .bash_profile</div>
<br />
export GOPATH="$HOME/projects"<br />
export PATH=$PATH:$GOPATH/bin
<br />
<br />
Then exit the Terminal App and open a new Terminal App. Check that the Go environment now has your new GOPATH.
<br />
<br />
<div style="background-color: #666666; color: #cccccc; padding: 5px;">
go env</div>
<br />
You should see all the Go related environment variables including GOPATH. Here are some of them:<br />
<br />
GOARCH="amd64"<br />
GOHOSTARCH="amd64"<br />
GOHOSTOS="darwin"<br />
GOOS="darwin"<br />
<b>GOPATH="/Users/you/projects"</b><br />
GOROOT="/usr/local/go"<br />
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"<br />
<h3>
<b><br />Step 4: &nbsp;Get, Build and Install Basic Packages</b></h3>
These are Go packages you may want:
<br />
<br />
<div style="background-color: #666666; color: #cccccc; padding: 5px;">
// gocode is used by many editors to provide intellisense<br />
go get github.com/nsf/gocode<br />
<br />
// goimports is something you should run when saving code to fill in import paths<br />
go get golang.org/x/tools/cmd/goimports<br />
<br />
// gorename is used by many editors to provide identifier rename support<br />
go get golang.org/x/tools/cmd/gorename<br />
<br />
// oracle is a tool that help with code navigation and search<br />
go get golang.org/x/tools/cmd/oracle<br />
<br />
// golint should be run after every build to check your code<br />
go get github.com/golang/lint/golint</div>
<h3>
<b><br />Step 5: &nbsp;Debugger</b></h3>
Using GDB is really not an option. If you would like to experiment with Delve, here is a link:<br />
<a href="https://github.com/derekparker/delve"><span class="sr-only">External resource on github.com: </span>https&#58;//github.com/derekparker/delve</a><br />
<div>
<div>
<h3>
<b><br />Step 6: Install Editor</b></h3>
<b><br />Sublime</b><br />
<a href="http://www.sublimetext.com/" target="_blank"><span class="sr-only">External resource on sublimetext.com: </span>http&#58;//www.sublimetext.com/</a><br />
<br />
DisposaBoy wrote this plugin for Sublime<br />
<a href="https://github.com/DisposaBoy/GoSublime" target="_blank"><span class="sr-only">External resource on github.com: </span>https&#58;//github.com/DisposaBoy/GoSublime</a><br />
<br />
Mark Wolfe wrote this post:<br />
<a href="http://www.wolfe.id.au/2015/03/05/using-sublime-text-for-go-development/" target="_blank"><span class="sr-only">External resource on wolfe.id.au: </span>http&#58;//www.wolfe.id.au/2015/03/05/using-sublime-text-for-go-development/</a><br />
<b><br /></b>
<b>VIM</b><br />
<a href="http://www.vim.org/download.php" target="_blank"><span class="sr-only">External resource on vim.org: </span>http&#58;//www.vim.org/download.php</a><br />
<br />
Victor Farazdagi wrote this post on installing Vim for Go:<br />
<a href="http://farazdagi.com/blog/2015/vim-as-golang-ide/" target="_blank"><span class="sr-only">External resource on farazdagi.com: </span>http&#58;//farazdagi.com/blog/2015/vim-as-golang-ide/</a><br />
<b><br /></b>
<b>Atom</b><br />
<a href="https://atom.io/" target="_blank"><span class="sr-only">External resource on atom.io: </span>https&#58;//atom.io/</a><br />
<br />
Joe Fitzgerald wrote this plugin for Atom<br />
<a href="https://github.com/joefitzgerald/go-plus" target="_blank"><span class="sr-only">External resource on github.com: </span>https&#58;//github.com/joefitzgerald/go-plus</a><br />
<b><br />LiteIDE</b><br />
<a href="http://sourceforge.net/projects/liteide/files/" target="_blank"><span class="sr-only">External resource on sourceforge.net: </span>http&#58;//sourceforge.net/projects/liteide/files/</a><br />
<br />
<b>Emacs</b><br />
This is the configuration Guillaume Charmes uses:<br />
<a href="https://github.com/creack/dotfiles"><span class="sr-only">External resource on github.com: </span>https&#58;//github.com/creack/dotfiles</a></div>
<h3>
<b><br />Helpful Links</b></h3>
Here are other links to web pages that will be very helpful:<br />
<br />
<a href="http://golang.org/" target="_blank"><span class="sr-only">External resource on golang.org: </span>http&#58;//golang.org/</a><br />
<a href="https://github.com/golang/go/wiki"><span class="sr-only">External resource on github.com: </span>https&#58;//github.com/golang/go/wiki</a><br />
<a href="http://blog.golang.org/" target="_blank"><span class="sr-only">External resource on blog.golang.org: </span>http&#58;//blog.golang.org/</a><br />
<a href="http://www.youtube.com/user/gocoding" target="_blank"><span class="sr-only">External resource on youtube.com: </span>http&#58;//www.youtube.com/user/gocoding</a><br />
<a href="http://dave.cheney.net/" target="_blank"><span class="sr-only">External resource on dave.cheney.net: </span>http&#58;//dave.cheney.net/</a><br />
<a href="http://gophervids.appspot.com/" target="_blank"><span class="sr-only">External resource on gophervids.appspot.com: </span>http&#58;//gophervids.appspot.com/</a><br />
<br />
You must watch these videos on Go Concurrency Patterns<br />
<br />
<a href="http://www.youtube.com/watch?v=QDDwwePbDtw" target="_blank"><span class="sr-only">External resource on youtube.com: </span>http&#58;//www.youtube.com/watch?v=QDDwwePbDtw</a><br />
<a href="http://www.youtube.com/watch?v=f6kdp27TYZs" target="_blank"><span class="sr-only">External resource on youtube.com: </span>http&#58;//www.youtube.com/watch?v=f6kdp27TYZs</a><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br /></div>
</div>
