5

when trying to use the VSCode Debugger, I get an error message:

"Failed to launch: could not launch process: can not run under Rosetta, check that the installed build of Go is right for your CPU architecture"

some background context as I read solutions for similar questions:

  • I use foundationDB which does not work with GO arm64
  • For this reason, I am using GO amd64
  • Switching to arm64 would mean that foundationDB will not work, which is not an option

I tried downloading dlv, but it doesn't work. Also tried the solution proposed here to run VSCode integrated terminal in x86-64.

Is there a way for the debugger to work with Apple M1 using go1.18 darwin/amd64?

  • Have you tried installing Homebrew in Rosetta mode (https://stackoverflow.com/a/64883440/5547232) and installing it through that? – Gigi Bayte 2 May 04 '22 at 04:39

2 Answers2

6

I just got this issue on my M1 and was able to resolve. Here are my steps:

  • go to the go download page, https://go.dev/dl/ and download the arm version of go installer. Specifically, go.darwin-arm64.pkg

  • install go, if it detects a previous version, agree to replace

  • open terminal and verify go version and it should say "go version go darwin/arm64"

  • On VSCode, click on plugins, find the installed Go plugin, and uninstall then reload VSCode.

  • When the plugin installation is complete, press Ctrl + Shift + P in VSCode to bring up the Command Palette, then type go: Install and select go: Install/Update Tools, then click the first checkbox to install all Tools.

  • When Go Tools install is complete, reload VSCode and retry breakpoint.

Mhz28
  • 69
  • 1
  • 3
0

This is a popular issue on Mac. The solution is to install Golang and VSCODE in ARM-64 (not AMD64).

Here are some links for reference

https://github.com/go-delve/delve/issues/2604

Cannot run debug Go using VSCode on Mac M1

Cyril
  • 151
  • 4