Troubleshoot: Running “Go Test” command in Mac

Praditya Adhitama
1 min readDec 30, 2019

--

Photo by Ben White on Unsplash

Go is an emerging programming language within our current programmer society nowadays. Have been dealing with the language for a few months back, I found that Go comes with a nice built-in feature for unit testing. Then a problem arose. I could not run the “go test” command because I do not have Xcode installed on my laptop for two apparent reasons; it consumes too much storage and I do not deal with mobile app development at the current moment. For those who have a similar condition with me, I would like to share the troubleshoot for this matter.

With that being said, we could easily fix this problem with a few steps:

  1. Install the Xcode command line

To run the “go test” command on Mac, we actually do not need to install the whole Xcode software. We just need to have the Xcode command line installed. To do this, on the terminal we can use this command:

sudo xcode-select --install

2. Reset the Xcode command line

To ensure the Xcode command line is working properly we need to restart it with this command:

sudo xcode-select --reset

That’s it guys, hopefully it could be useful for you fellow programmers.

Cheers!

--

--