moovweb / gvm

Go Version Manager
http://github.com/moovweb/gvm
MIT License
9.87k stars 520 forks source link

Cannot install Go 1.4 #459

Open grandstairs opened 4 months ago

grandstairs commented 4 months ago

I am struggling to figure out how to install Go on an ARM / Apple Silicon macbook.

$ gvm install go1.4
Installing go1.4...
 * Compiling...
/Users/owner/.gvm/scripts/install: line 93: go: command not found
ERROR: Failed to compile. Check the logs at /Users/owner/.gvm/logs/go-go1.4-compile.log
ERROR: Failed to use installed version

Line 93 requires go env to be working which it isn't because there is no Go binary installed.

So then I tried to install a Go 1.4 binary directly and that failed as well.

$ gvm install go1.4 -B                 
Installing go1.4 from binary source
ERROR: Failed to download binary go
$ echo $PATH
/Users/owner/.rvm/bin:/Users/owner/.gvm/bin:/opt/homebrew....
$ which go
go not found
kaykhan commented 3 months ago

Did you find a fix?

grandstairs commented 3 months ago

No, I went back to using homebrew for now and just manually changing versions if needed.

$ which go
/opt/homebrew/bin/go
$ go version
go version go1.22.0 darwin/arm64
ryan-ju commented 1 month ago

I found a workaround (on macos). Instead of doing the crazy bootstrapping chain, you can do this:

  1. Download the .tar.gz file from the official site https://go.dev/dl/ and unpack it somewhere (it'll decompress to a go dir)
  2. In a terminal add the go to PATH:
export PATH="<where your go dir is>/bin:$PATH"
  1. Run gvm install go1.22.3 or whatever version you need.
  2. Delete the go dir in step 1
  3. Then run gvm use go1.22.3 --default. Otherwise it'll complain about invalid go version (you need to set a default, gvm doesn't set it for you).

Note the latest go actually requires >= 1.20 to compile

Kyungminkim31 commented 3 days ago

I found a workaround (on macos). Instead of doing the crazy bootstrapping chain, you can do this:

  1. Download the .tar.gz file from the official site https://go.dev/dl/ and unpack it somewhere (it'll decompress to a go dir)
  2. In a terminal add the go to PATH:
export PATH="<where your go dir is>/bin:$PATH"
  1. Run gvm install go1.22.3 or whatever version you need.
  2. Delete the go dir in step 1
  3. Then run gvm use go1.22.3 --default. Otherwise it'll complain about invalid go version (you need to set a default, gvm doesn't set it for you).

Note the latest go actually requires >= 1.20 to compile

This works perfectly! Thanks!