Custom Search Engine on Safari and Spotlight (MacOS)
You want to have your own search engine on your Mac. Let me help you.
You can re-route one of the five choices (as of 2026) to your custom search engine like SearXNG for Safari and Spotlight.
I expect you to be cautious about any code that is asking you to get sudo access on your system and make changes, so investigate and understand externally. You should not (cannot) trust me, therefore I provide no further explanation of this code.
This is as much a personal log as it is a guide.
Henceforth, here be dragons, pet them cautiously
Details in the form will update the code fragments below as a convenience.
01 - generate certificate
openssl
02 - trust certificate
trustRoot - requires sudo
03 - redirect domain
/etc/hosts - requires sudo
04 - redirect server
~/redirect.py
05 - auto-start on boot
/Library/LaunchDaemons/com.cusearch.redirect.plist - requires sudo
06 - load service
launchctl - requires sudo
Finally:
- Set Safari → Settings → Search to HIJACKED_SEARCH_ENGINE.
- Do the same in System Settings → Siri & Spotlight.