VSCode Debugger not working under Rosetta

4k Views Asked by At

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?

2

There are 2 best solutions below

1
On

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

0
On

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.