Hi. Trying to find a file in MacOS

where the GoPath / GoRoot env variables are set / exported. I can run go in the term so I know its installed right, just cant find the file it is set in. i checked .bash_profile and .bashrc. i installed go with a binary.

Unless you have them overwritten in one of your startup files, the go executable uses some defaults.

GOPATH and GOROOT are set in your shell, or else Go uses its defaults. The default is for GOPATH to be ~/go and for GOROOT to be the directory above wherever the go command binary is.

Is the “shell” the .bash_profile file ?

The shell is bash, if that’s what you’re running. Bash is the default shell on the Mac, so unless you changed it, it probably is.

Unfortunately bash has a rather complicated set of rules for which configuration files get loaded in what order. I’ve written an article about it.

I wasn’t able to use Julia from the term, only from its own dedicated console. so I added these lines and now I can use julia from anywhere. I can use Go from anywhere now, where can I find that code just like this one for julia ?

Depending on how you installed go, its already at a place known to your PATH, in my system there is a softlink at /usr/bin/go (and /usr/bin is in PATH) which points to /usr/lib/go/bin/go, perhaps there is something similar going on at your place?

You can use which go; ls -lh $(which go) wo find out more about gos current location.

where do I find “PATH” , which folder / file name ?

Found it. /etc/paths.d/go

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.