Set up local development with Zoekt and Sourcegraph

$ git clone
$ git clone

To see your Zoekt changes reflected live on your local Sourcegraph instance, you'll have to modify your Sourcegraph go.mod file so that the Zoekt dependency is pointed to your local folder.

Change at the bottom:

replace (
    ... => <your zoekt repository directory>

This isn't hot reloaded so you might have to restart Sourcegraph on every Zoekt change. It may make sense to ensure your changes in Zoekt are working first before trying them out in Sourcegraph.


Here are some commands you can run against Zoekt.


$ go install ./cmd/...
$ go install ./cmd/<specific command> (ex zoekt-archive-index)

The components that Sourcegraph uses from Zoekt are zoekt-archive-index, zoekt-git-index, zoekt-sourcegraph-indexserver, and zoekt-webserver.

# Direct usage
$ zoekt-index <repository>
$ zoekt <query>


Index files are stored in:

  • ~/.zoekt (zoekt cmd)
  • ~/.sourcegraph/zoekt/index-X (sourcegraph)

Local Sourcegraph Zoekt UI can be accesed at localhost:3070 and localhost:3071 (we have multiple instances because of horizontal scaling).