{"record":{"id":"cf7c9872b97bdff5","repo":"go-delve/delve","slug":"can-not-run-under-rosetta-check-that-the-terminal","errorCode":null,"errorMessage":"can not run under Rosetta, check that the terminal/shell in use is right for your CPU architecture","messagePattern":"can not run under Rosetta, check that the terminal/shell in use is right for your CPU architecture","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/gdbserial/gdbserver.go","lineNumber":2257,"sourceCode":"\nfunc checkRosettaExpensive() error {\n\tif runtime.GOOS != \"darwin\" {\n\t\treturn nil\n\t}\n\tif runtime.GOARCH != \"arm64\" {\n\t\treturn nil\n\t}\n\n\t// Additionally check the output of 'uname -m' if it's x86_64 it means that\n\t// the shell we are running on is being emulated by Rosetta even though our\n\t// process isn't. In this condition debugserver will crash.\n\tout, err := exec.Command(\"uname\", \"-m\").Output()\n\tif err != nil {\n\t\treturn nil\n\t}\n\ts := strings.TrimSpace(string(out))\n\tif s == \"x86_64\" {\n\t\treturn errors.New(\"can not run under Rosetta, check that the terminal/shell in use is right for your CPU architecture\")\n\t}\n\treturn nil\n}\n","sourceCodeStart":2239,"sourceCodeEnd":2261,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/gdbserial/gdbserver.go#L2239-L2261","documentation":"checkRosettaExpensive runs 'uname -m' and rejects launching when the shell reports x86_64 on darwin, because that means the terminal (and any child processes) run under Rosetta x86 translation while Delve expects arm64. Debugging under Rosetta breaks native process control, so Delve fails fast with this message.","triggerScenarios":"Calling gdbserial Listen or Dial on macOS (arm64) when the environment's 'uname -m' returns x86_64, i.e. Delve itself or its shell is running as an x86_64 Rosetta binary.","commonSituations":"Installing the x86_64 Homebrew delve on an Apple Silicon Mac; launching an IDE (VS Code) under Rosetta so the debug session inherits x86_64; opening a terminal via an x86_64 iTerm/Terminal process; copy of dlv built with GOARCH=amd64 by mistake.","solutions":["Install/run the arm64 build of Delve (brew install delve on native Homebrew, or build with GOARCH=arm64)","Relaunch the terminal/IDE as a native arm64 process (uncheck 'Open using Rosetta')","Verify with 'file $(which dlv)' and 'uname -m' that both report arm64","Rebuild dlv without Rosetta: arch -arm64 go install github.com/go-delve/delve/cmd/dlv@latest"],"exampleFix":"// before (Rosetta shell)\nuname -m  # x86_64\n./dlv debug\n// after\narch -arm64 /bin/zsh\nuname -m  # arm64\nfile $(which dlv)  # Mach-O 64-bit executable arm64\n./dlv debug","handlingStrategy":"validation","validationCode":"out, err := exec.Command(\"uname\", \"-m\").Output()\nif err != nil || strings.TrimSpace(string(out)) != \"arm64\" {\n    return fmt.Errorf(\"delve must run as native arm64; got %q\", strings.TrimSpace(string(out)))\n}\n// also check the dlv binary itself:\n// file $(which dlv)  -> expect 'arm64'","typeGuard":"func isNativeArm64(unameOut []byte) bool {\n    return strings.TrimSpace(string(unameOut)) == \"arm64\"\n}","tryCatchPattern":null,"preventionTips":["Install delve via native arm64 Homebrew (/opt/homebrew), not Rosetta x86_64 brew","Launch IDEs and terminals as native arm64 (disable 'Open using Rosetta')","Verify with 'file $(which dlv)' and 'uname -m' before debugging"],"tags":["macos","rosetta","architecture-mismatch","gdbserial"],"backgroundTag":"architecture-mismatch","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}