7

I have problems with my debugger go on a MacBook Pro M1 Pro.

When I try to debug my code I have this error:

"could not launch process: stub exited while waiting for connection: exit status 0" 

I got this error when launching the debugger via VSCode, Goland and via the "dlv debug" command.

I wanted to know if someone had a solution to my problem.

Here is some information about my configuration:

go version go1.18.5 darwin/arm64
Delve Debugger
Version: 1.9.0
Build: $Id: 69310c2f438e492f892d6af22e8e62c8ea1e9d8d $
  • 1
    also you can reinstall XCode CLI Tools to see if it helps. – s0xzwasd Aug 17 '22 at 09:55
  • Hi, Thank you very much, I just had to reinstall XCode CLI tools... I thought I had done it correctly but then the reinstallation worked. – patrick lamatiere Aug 18 '22 at 13:13
  • @patricklamatiere were you encountering the error in your VSCode? For me it works on iterm but not on the VScode integrated terminal! I get the identical error you were getting. Also what did you use to reinstall XCode CLI Tools? – ZeusLawyer Aug 18 '22 at 15:07
  • @ZeusLawyer, please see: https://apple.stackexchange.com/a/375535 – s0xzwasd Aug 19 '22 at 08:22
  • @s0xzwasd - thank you. Reinstalled, but still getting the same error from the VSCode integrated terminal. Interestingly, not getting it in iterm! dlv debug works there. – ZeusLawyer Aug 20 '22 at 12:51
  • @ZeusLawyer Hi, I had the same error everywhere no matter what terminal I use, just uninstall the XCode CLI Tools to run and I can debug from anywhere now. – patrick lamatiere Aug 25 '22 at 09:56
  • Sadly didn't work for me :( may have to raise an issue on the vscode golang extension GitHub. – ZeusLawyer Aug 26 '22 at 10:18

3 Answers3

10

None of the responses above worked for me. Then, after two days of research I saw someone saying that I should install the M1 version of VSCode (not the universal version!)

I had the "Universal" version, but when I checked Activity Monitor I found out that it was running as Intel. So I uninstalled it and downloaded the M1 version (specifically) from here:

https://code.visualstudio.com/download# (choose Apple Silicon).

Now debugging in VSCode works fine (I haven't tried in Goland).

Nando Machado
  • 182
  • 1
  • 11
  • I tried that too ! And uninstalled Rosetta but that broke a ton of other things. Dlv CLI now works for me via iterm but not in integrated terminal ok vscode. – ZeusLawyer Sep 13 '22 at 10:37
  • 2
    This fixed the problem for me. I was using the Universal version on M1 mac and after uninstalling the universal one and installing the M1 specific version, it worked for me. Did not do anything else other than installing the right version for the OS/Arch combination that works for M1 mac. – Jasmeet Singh Dec 26 '22 at 23:28
  • 1
    This was absolutely the answer for me, thanks. – rfay Jan 30 '23 at 23:02
  • you are lifesaver – Sinnyn Jun 21 '23 at 08:13
4

Re-installing XCode Command Line Tools should help.

  • Delete a previous version of XCode Tools:
sudo rm -rf /Library/Developer/CommandLineTools
  • Install it from scratch:
xcode-select --install
s0xzwasd
  • 2,895
  • 3
  • 17
  • 26
3

Check if running

sudo /usr/sbin/DevToolsSecurity -enable 
TiGo
  • 652
  • 6
  • 11