Prepare Your Mac for Go Development
This article helps you get your Mac ready for your first project using the Go programming language. It discusses system configurations, supporting software, language installation, and more.
Apr 12th, 2025 7:00am by
Let’s Go!
Golang (commonly known as “Go”) is an open source programming language designed to address concerns with existing development challenges, including slow build times, inefficient dependency management, and complex codebases. Go exhibits several key features that make it an attractive development language. These features include:- Simple syntax: Go’s syntax is straightforward, making it relatively easy to learn and work with. It is inspired by the C programming language.
- Performance: Go is a compiled language, meaning its machine code enables good performance.
- Memory management: Automatic memory management with garbage collection.
- Cross-platform compatibility: Go supports macOS, Linux, and Windows environments.
- Server-side web applications and APIs.
- Cloud native applications.
- Distributed services and applications.
- Automation apps for DevOps environments.
Set Up MacOS and Go
I try to keep my host system pretty clean, so I use virtual machines to experiment with things like new languages. I prefer Parallels virtualization on my MacBook Pro. I start with the stock Mac VM images.
Figure 1: Parallels management panel, including a macOS VM.
- Clean up the native macOS Dock by removing the extensive list of applications you probably won’t need on a VM-hosted dev workstation.
- Configure Spaces for two or more virtual desktops to save time.
- Set some inspiring wallpaper (maybe something with a Go theme).
- Configure the trackpad and keyboard as you see fit.
- Define your preferred display settings.
- Install your favorite browser if you don’t use Safari.
- Configure any external or cloud-based storage.
- Update the macOS operating system in the VM.
Add the Homebrew Package Manager
Once you set the OS how you like it, I strongly suggest installing the Homebrew package manager. Package managers make it much easier to maintain software, especially for applications not available on Apple’s App Store (and many such programs exist). Homebrew is easy to install and easy to use. Simply open the macOS Terminal and enter the following script:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Figure 2: Use the brew --version command to confirm the installation.
Update the Terminal
Speaking of the Terminal, you can get a lot of mileage out of installing and configuring a more robust terminal application. I suggest iTerm2. You might also supplement it with the Oh-My-Zsh framework for additional customizations. Just beware — delving into customized terminals can be a rabbit-hole of fun, explorations, and additional mods. Consider a few basic settings for your initial iTerm2 configurations, such as split panes, preferred color schemes, type sizes, etc.Brew to Go
Use the Homebrew package manager to add Go to your Mac. You’ll need the standard Homebrew installation command:
brew install go
go version
- Download the installer.
- Run the installer by double-clicking the .pkg file.
- Follow the provided installation instructions.
- Set Go’s environment variables:
-
- export GOROOT=/usr/local/go
- export GOPATH=$HOME/go
- export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
- Update your changes by typing source ~/.zshrc
Git It Together
Git is the de facto standard for maintaining today’s coding projects. It offers excellent version control, extensive collaboration, and robust code management features. Your final setup task for adding Go support to your Mac is installing Git. Various approaches exist, but the two most common are Homebrew, Xcode, and GitHub Desktop. Assuming you installed Homebrew above, just run the brew install git command in the Terminal. Use the git –version command to confirm the installation.
Figure 3: Use the git --version command to confirm the installation.
Add Your IDEs
One of the most critical coding tools is an integrated development environment (IDE). These tools often provide code suggestions, autocompletion, testing, linting, and other essential management tasks. Many IDEs exist for Go. Some are dedicated to Go, and others support multiple programming languages. If you already work with Python, Swift, Java, or other languages, you may want to consider one of these more extensive IDEs. Start your Go journey by selecting from among these IDEs that run on macOS. GoLand by JetBrains JetBrains creates many programming tools. One is the Go-specific GoLand IDE. It’s a great place to start coding in Go. GoLand’s general features include:- Code completion.
- Code refactoring.
- Built-in debugging and testing.
- Extensive plugin support and customization.
- Cross-platform macOS, Linux, and Windows support.
- Syntax highlighting.
- Code formatting.
- Debugging.
- Development management tools for projects.
- Markdown integration (for documentation).
- Cross-platform macOS, Linux, FreeBSD, OpenBSD, and Windows support.
- Intelligent suggestions.
- Debugging, error-checking, refactoring, etc.
- Extensive environment customization.
- Git integration.
- Supports many programming languages beyond Go.
Edit for Success
Dedicated IDEs are crucial to most coding projects. However, text editors can be helpful for small tasks, quick edits, or as lightweight tools on older systems. Don’t be surprised to find that these text editors support extensive customization that virtually transforms them into full-fledged IDEs with little effort. Vim or Neovim Sometimes, the best tool is old traditional one. In this case, that’s Vim or one of its variations, such as Neovim. This text editor is terminal-based, lightweight, highly customizable, and fast. While common for Linux, it runs well on macOS. If you add a few plugins, you can easily construct a robust Go code editor/IDE that features autocompletion, linting, syntax highlighting, debugging, and more. Vim’s learning curve is steeper than some other tools, but it is not really a major barrier. It’s great for experienced developers/administrators who are integrating coding with terminal-based dev workflows.
Figure 4: Even a basic Vim configuration is sufficient for basic Go coding.
- The Go development team maintains an official VS Code extension.
- Many additional plugins and extensions are available to enable customization.
- Syntax highlighting, testing, and debugging capabilities.
- Git integration for version control.
Figure 5: Use VS Code for Go programming.
Wrap Up
Go is a great language for new developers, and it’s useful for experienced programmers branching out or expanding their careers. You’ll find it handy for cloud app development, server-side programs, automation tasks, and distributed computing.
Figure 6: Go is one of the more popular programming languages according to the 2024 Stack Overflow Developer Survey.
YOUTUBE.COM/THENEWSTACK
Tech moves fast, don't miss an episode. Subscribe to our YouTube
channel to stream all our podcasts, interviews, demos, and more.
