Skip to content

Use any DuckDuckGo bang as your default Safari search engine. Instant redirects without waiting for DuckDuckGo to load.

License

Notifications You must be signed in to change notification settings

bpdev97/unduck-for-safari

Repository files navigation

unduck for Safari

Safari port of Theo's unduck - instant bang redirects for DuckDuckGo searches. No more waiting for DDG to load just to bounce you somewhere else.

Why this exists

Safari doesn't let you set custom search engines. With unduck, you can use ANY DuckDuckGo bang as your default search engine. Want Brave? Set default_bang = "!brave". Prefer Startpage? Use !sp. YouTube? !yt. You get the idea.

Plus bang redirects are virtually instant. No more watching DuckDuckGo load just to bounce you somewhere else.

Why not a Safari extension?

Safari extensions have to wait for the page to start loading before they can act. With DNS interception, we redirect before Safari even connects to DuckDuckGo.

Installation

./install.sh

This will:

  • Generate a self-signed certificate for duckduckgo.com
  • Add it to your macOS Keychain as trusted
  • Modify /etc/hosts to point duckduckgo.com to localhost
  • Build and install the unduck binary
  • Optionally set it up as a background service

Important: After installation, set DuckDuckGo as your default search engine in Safari preferences.

Configuration

Edit ~/.config/unduck/config.toml:

# Default search engine (any DDG bang!)
default_bang = "!g"  # Change to !brave, !qwant, !ecosia, etc.

# Log verbosity: debug, info, warn, error
log_level = "info"

# Override or add custom bangs
[custom_bangs]
"!internal" = "https://internal.company.com/search?q={{{s}}}"
"!k" = "https://kagi.com/search?q={{{s}}}"

# Autocomplete mappings (for search engines with DDG-compatible APIs)
[autocomplete]
# Add your search engine's autocomplete endpoint here

Autocomplete Support

If your chosen search engine uses the same autocomplete format as DuckDuckGo (returning [query, [suggestions]]), you can enable autocomplete by adding it to the config. Kagi for instance, utilizes the same response schema: "https://kagi.com/api/autosuggest?q={query}"

Usage

Keep DuckDuckGo as your Safari search engine. Now:

  • Regular searches use your configured default_bang
  • Any DDG bang still works: !gh react, !gi corgis, !yt programming
  • Autocomplete works for compatible search engines

Supports all ~13k DuckDuckGo bangs!

Running manually

If you didn't install the service:

unduck

Uninstall

./uninstall.sh

Removes the hosts entry, certificate, and service.

Development

Update bang definitions:

go generate

This fetches the latest bangs from DuckDuckGo.

About

Use any DuckDuckGo bang as your default Safari search engine. Instant redirects without waiting for DuckDuckGo to load.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published