Replacing Google with SearXNG as the default in Chrome

Over on the Self-Hosted podcast we've been taking the "no Googtober" challenge for the month of October. Yes it is November now, but this probably gives you a clue as to how the challenge is going. (Spoiler: really well!).

One thing that was irking me though was figuring out how to set a custom default search engine in Chrome. Because as we all know, default is king. Turns out it's quite straightforward so I'll walk you through setting it up!

SearXNG

If you're not familiar, SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.

I assume you have SearXNG set up and ready to go - there's a docker compose YAML in this Gist I threw together.

Configuring Chrome

Google makes it a little tricky to find exactly where you should configure a custom search engine (cynically this is not too surprising!). But here's how:

  1. In Chrome, click the 3 dot menu button in the top right
  2. Select Settings
  3. Select Search engine in the left menu pane
  4. Select Manage search engines and site search
  5. Leave the default keyboard shortcut set to Space or Tab unless you have a good reason not to
  6. Select Add under Site search
  7. Give your new search provider a name
  8. Enter whatever you like for Shortcut - something like @searxng is fine
  9. Populate URL with %s in place of query with the value from the steps below
  10. Take your SearXNG URL and append search?q=test - for example https://search.example.com/search?q=test
  11. Assuming that worked replace test with %s - for example https://search.example.com/search?q=%s
  12. Select Add once the fields are complete
  13. Make this new Site search provider your Chrome default by selecting the 3 dot menu (pictured below) for the new provider, and selecting Make default
  14. Profit!

Now when you enter a search query in the Chrome address bar it will route through your SearXNG instance. Nice!