bash: /home/linuxbrew/.linuxbrew/bin/go: Bad address

1.6k Views Asked by At

I did an brew upgrade and afterwards keep getting an bad address error. Tried to uninstall/reinstall everything, but cant figure out what is the problem.

bash: /home/linuxbrew/.linuxbrew/bin/go: Bad address

Im new to terminal and linux, so all advice is welcome.

I tried brew doctor. It says "No developer tools installed." and after i 'brew install gcc' it says gcc is already installed and up-to-date.

2

There are 2 best solutions below

3
On

Use the official Go installation:

Go: Download and install

For full support, avoid OS package managers, Homebrew, and so forth.


First, remove any previous installations by other methods, for example, Homebrew.

0
On

Little late, but this post was a suggestion for me when I ran into a similar issue with Go and Brew.

When Brew updates the version of Go (1.19.3 -> 1.19.5 in my case) that it is providing, for some reason it does not correctly update the GOROOT environment varaible. Correcting the value of the variable fixed the issue for me.

export GOROOT=/home/linuxbrew/.linuxbrew/Cellar/go/<go_version>/libexec

# example
export GOROOT=/home/linuxbrew/.linuxbrew/Cellar/go/1.19.5/libexec