Safari Keyword Search


Safari Keyword Search is an extension for Safari on Mac, iPhone and iPad that lets you search any site straight from the address bar. Type a keyword before your search and you go directly to that site’s results. For example, type w monkeys to search Wikipedia for monkeys, or y rick astley to search YouTube.

You can also use it to replace Safari’s search engine with any search you like.

Getting started

  1. Install the app from the App Store.
  2. Turn on the extension in Safari:
  3. Allow the extension to access your search engine’s website when Safari asks (Always Allow on This Website while you are on it). Without this permission Keyword Search can’t see your searches, so the keywords won’t work. If you switch search engines now and then, choose Always Allow on Every Website instead. Keyword Search doesn’t need access to the sites it sends you to.
  4. Try typing y rick astley in the address bar.

Default searches

These searches are included from the start:

Your own searches

Open the extension’s settings from Safari: the Keyword Search button in the toolbar on Mac and iPad, or the page menu on iPhone. There you can edit, delete and add searches.

A search needs one or more keywords, separated by commas, and a URL with @@@ where the search terms should go, for example https://example.com/search?q=@@@.

Settings

Make default
Turn this on for one of your searches to use it whenever you search without a keyword, instead of Safari’s own search engine. This is a way to use a search engine Safari doesn’t offer as your primary search engine.
Safari’s search engine
Keyword Search works by recognizing the search that Safari makes, whichever search engine you use. If you pick the search engine set in Safari’s settings here, keywords only work for searches from the address bar, and not when you search on Google’s (or DuckDuckGo’s etc.) own website. The default, Any, works with all search engines. Baidu, Sogou and 360 Search are only recognized by their address, so for those the setting can’t tell the two apart.
Allowed keyword locations
Choose whether you can also type the keyword after your search, like monkeys w. This can be overridden for each search.
Advanced settings for each search
What spaces in your search are replaced with (+ by default, Wikipedia uses _), and whether the search terms are URL-encoded.
Export and import
Copy all your searches and settings to the clipboard, or paste them back in, for backups or moving between devices without iCloud.

Sync

Your searches and settings sync between your Mac, iPhone and iPad through your own iCloud account. Changes made on different devices are merged, so if you add searches on two devices, you keep both. Devices that still run an older version of the app keep syncing too.

Requires Safari 17 or later (iOS and iPadOS 17, or macOS 12 or later with Safari 17).

Did the extension disappear from Safari on the Mac?

There is a bug in Safari on macOS where extensions sometimes disappear. To fix it:

  1. Quit Safari.
  2. Open Terminal, then copy and paste this command:
    /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f -R /Applications/Safari.app
  3. Open Safari again.
  4. Go to Safari Settings → Extensions. Keyword Search should be back. If it is unchecked, check it to turn it on again.

Thanks to Jeff Johnson for figuring that out and @porg for helping clarify these instructions.

How it works, and weird details and limitations

Safari doesn’t let extensions change how the address bar searches, so Keyword Search works like this:

  1. It listens for Safari starting to load a page.
  2. It checks whether the address belongs to one of the search engines Safari can use: Google, Bing, Yahoo (including regional Yahoo sites), DuckDuckGo, Ecosia, Baidu, Sogou or 360 Search. If you have picked Safari’s search engine in the settings, only that one counts, and only with the details Safari adds to searches from the address bar.
  3. It reads the search terms from the address.
  4. If the search starts with one of your keywords, it quickly sends the tab to that search instead.

Reading the search terms from the address is not ideal, but it’s the only way with the current extension APIs. These edge cases can happen:

Safari also has a newer way for extensions to redirect pages before they load (declarativeNetRequest), which would avoid loading the search engine at all. I tried using it, but it currently seems to flaky and brittle to be usable.

The old Safari extension API had a beforeSearch event that made all of this a lot easier. To any Safari developers who might be reading this: hello!

Privacy policy

Created by Arne Martin Aurlien | View on GitHub | Questions, support? Send me an email