macOS Installing Go in macOS Sierra Errors
Installation errors
If you tried to install a newer version you might get a similar error to this:
$ gvm install go1.12
Downloading Go source...
Installing go1.12...
* Compiling...
ERROR: Failed to compile. Check the logs at ~/.gvm/logs/go-go1.12-compile.log
ERROR: Failed to use installed version
And the error log:
Building Go cmd/dist using ~/go1.4.
ERROR: Cannot find ~/go1.4/bin/go.
Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.
That means that you need a version of go installed in order to compile the version you are trying to install- I recommend to install a binary close to your targeted version:
gvm install go1.10.1 -B
Bootstraping gvm
If you are trying to install go through gvm
for the first time you might get the following error:
# Building C bootstrap tool.
cmd/dist
# Building compilers and Go bootstrap tool for host, darwin/amd64.
lib9
libbio
liblink
cmd/cc
cmd/gc
cmd/6l
~/.gvm/gos/go1.4/src/cmd/6l/../ld/dwarf.c:1472:15: error: implicit conversion from 'int' to 'char' changes value from 156 to -100 [-Werror,-Wconstant-conversion]
~/.gvm/gos/go1.4/src/cmd/6l/../ld/dwarf.c:1756:21: error: implicit conversion from 'int' to 'char' changes value from 144 to -112 [-Werror,-Wconstant-conversion]
~/.gvm/gos/go1.4/src/cmd/6l/../ld/lib.h:168:13: note: expanded from macro 'cput'
go tool dist: FAILED: clang -Wall -Wstrict-prototypes -Wextra -Wunused -Wno-sign-compare -Wno-missing-braces -Wno-parentheses -Wno-unknown-pragmas -Wno-switch -Wno-comment -Wno-missing-field-initializers -Werror -fno-common -ggdb -pipe -Wuninitialized -O2 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -mmacosx-version-min=10.6 -c -m64 -I ~/.gvm/gos/go1.4/include -I ~/.gvm/gos/go1.4/src/cmd/6l -o ~/.gvm/gos/go1.4/pkg/obj/cmd/6l/dwarf.o ~/.gvm/gos/go1.4/src/cmd/6l/../ld/dwarf.c
You can solve this by installing the binary directly using the -B
or --binary
flag:
gvm install go1.4 --binary