go-delve/delve · error

can not run under Rosetta, check that the terminal/shell in

Error message

can not run under Rosetta, check that the terminal/shell in use is right for your CPU architecture

What it means

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.

Source

Thrown at pkg/proc/gdbserial/gdbserver.go:2257

func checkRosettaExpensive() error {
	if runtime.GOOS != "darwin" {
		return nil
	}
	if runtime.GOARCH != "arm64" {
		return nil
	}

	// Additionally check the output of 'uname -m' if it's x86_64 it means that
	// the shell we are running on is being emulated by Rosetta even though our
	// process isn't. In this condition debugserver will crash.
	out, err := exec.Command("uname", "-m").Output()
	if err != nil {
		return nil
	}
	s := strings.TrimSpace(string(out))
	if s == "x86_64" {
		return errors.New("can not run under Rosetta, check that the terminal/shell in use is right for your CPU architecture")
	}
	return nil
}

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Install/run the arm64 build of Delve (brew install delve on native Homebrew, or build with GOARCH=arm64)
  2. Relaunch the terminal/IDE as a native arm64 process (uncheck 'Open using Rosetta')
  3. Verify with 'file $(which dlv)' and 'uname -m' that both report arm64
  4. Rebuild dlv without Rosetta: arch -arm64 go install github.com/go-delve/delve/cmd/dlv@latest

Example fix

// before (Rosetta shell)
uname -m  # x86_64
./dlv debug
// after
arch -arm64 /bin/zsh
uname -m  # arm64
file $(which dlv)  # Mach-O 64-bit executable arm64
./dlv debug
Defensive patterns

Strategy: validation

Validate before calling

out, err := exec.Command("uname", "-m").Output()
if err != nil || strings.TrimSpace(string(out)) != "arm64" {
    return fmt.Errorf("delve must run as native arm64; got %q", strings.TrimSpace(string(out)))
}
// also check the dlv binary itself:
// file $(which dlv)  -> expect 'arm64'

Type guard

func isNativeArm64(unameOut []byte) bool {
    return strings.TrimSpace(string(unameOut)) == "arm64"
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31). Data as JSON: /api/errors/cf7c9872b97bdff5. Report an issue: GitHub.