Resolving 'Delve Executable Not Found' Error in GoLand IDE for macOS

Akshay MukadamAkshay Mukadam
3 min read

If you're working with Go in GoLand on macOS, you may come across the following error when attempting to debug your code:

Cannot find the Delve executable for darwin/amd64. 
Specify the Delve location by adding 'dlv.path=/path/to/delve' in 'Help | Edit Custom Properties'.

This error occurs when GoLand cannot find the Delve debugger, which is essential for debugging Go applications. This post will guide you through how to resolve this issue by installing Delve and configuring it in GoLand.

What is Delve?

Delve is a debugger specifically designed for the Go programming language. It allows developers to inspect their code, set breakpoints, view variables, and step through program execution, making it an indispensable tool for debugging Go applications.

Step-by-Step Guide to Fix the Error

1. Install Delve

If you don’t already have Delve installed, you can easily install it using the following command in your terminal:

go install github.com/go-delve/delve/cmd/dlv@latest

This command installs the latest version of Delve and places the dlv executable in your $GOPATH/bin directory, which is usually ~/go/bin by default

2. Find the Delve Path

Once Delve is installed, you need to locate where the dlv executable was installed. Run the following command in your terminal to find the exact path:

which dlv

This will show something like this, this can differ on your machine.

/usr/local/bin/dlv

Make a note of this path, as you will need it in the next step.

3. Configure Delve in GoLand

Now that you have Delve installed and know its path, you need to tell GoLand where to find it.

  1. Open GoLand.

  2. Navigate to Help > Edit Custom Properties in the menu bar.

  3. In the file that opens, add the following line (replacing dlv.path=/Users/akshaymukadam/go/bin/pkg/mod/github.com/go-delve/delve@v1.22.1/cmd/dlv with the actual path to your Delve executable): The above stated dlv path can differ on your machine. Replace with the following line dlv.path=/usr/local/bin/dlv

  4. Save and close the file.

4. Restart GoLand

Once you’ve added the custom properties, restart GoLand for the changes to take effect. When GoLand restarts, it will look for the Delve executable in the location you specified, resolving the "Cannot find the Delve executable" error.

5. Verify Delve is Working

After restarting, try running or debugging your Go application again. If everything was configured correctly, the debugger should now work without any issues.

Troubleshooting

If you’re still encountering problems after following the steps above, here are a few things to check:

  • Ensure Delve is in Your PATH: Sometimes GoLand may not pick up the dlv binary even after configuring it. Make sure that the directory containing dlv is included in your system’s $PATH environment variable. You can check this by running:

      echo $PATH
    

    If your go/bin directory is missing, add it by updating your shell configuration (e.g., .bash_profile, .zshrc):

      export PATH=$PATH:~/go/bin
    
  • Check GoLand Debug Configuration: If you’ve set up everything correctly but the debugger still doesn’t work, double-check your GoLand run/debug configuration to ensure that it is correctly set up for the project you’re working on.

Conclusion

The "Cannot find the Delve executable" error in GoLand 2024.2.2 on macOS is straightforward to fix by installing Delve, setting the appropriate path in GoLand’s custom properties, and restarting the IDE. Once configured, you’ll be able to harness the full power of Delve for debugging Go applications.

With this fix in place, you can now step through your code, inspect variables, and debug effectively using GoLand and Delve!

This issue has been there since Goland 2023.1 version , earlier we never required to do this kind of a setup, but something has changed in the internal working of the IDE that has lead to this.

1
Subscribe to my newsletter

Read articles from Akshay Mukadam directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Akshay Mukadam
Akshay Mukadam

Started as an Android Developer and recently switched to Backend. I share my learnings as I progress on my job. I generally share backend engineering post or a simple how to tutorials or a productivity shortcuts that can be used in our day to day life.