Skip to content

Instantly share code, notes, and snippets.

@dmdeller
Created November 18, 2011 19:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmdeller/1377532 to your computer and use it in GitHub Desktop.
Save dmdeller/1377532 to your computer and use it in GitHub Desktop.
DuckDuckGo Hosts File information

Hosts File

NOTE: This feature is currently in beta. The server IP below will change when the beta ends.

As discussed here, Safari doesn’t allow you to customize the search engines available from the search bar.

However, there is a simple hack you can do. DuckDuckGo operates a server that can respond to Safari’s search requests directed at Yahoo, Google, or Bing, and send those to DuckDuckGo instead. To use it, you can either use an app to make the change, or edit your hosts file directly.

Method 1: Mac app

A third-party app which can set this up automatically for you is available here. Note that this app is not provided by DuckDuckGo.

After you use this app, selecting Yahoo in the Safari search bar will search DuckDuckGo instead. Likewise, if you set your default to Yahoo in Safari Preferences, your default will actually be DuckDuckGo.

If you change your mind, open the app again to undo the changes.

Method 2: Editing the hosts file

This is intended only for advanced users.

Mac users: Open the Terminal app. This is in your Applications folder, in the Utilities folder.

Type this command:

sudo nano /etc/hosts

You will be asked for your password. Type it and press return. Note that nothing will appear in the window as you are typing; this is normal.

This starts the Nano text editor. Use the arrow keys to move to the end of the file, press return a few times, and add this line:

72.94.249.35 search.yahoo.com

Then save the file by pressing Control-O, and quit Nano by pressing Control-X.

TODO: Instructions for Windows users

Restart Safari after you do this. From now on, selecting Yahoo in the Safari search bar will search DuckDuckGo instead. Likewise, if you set your default to Yahoo in Safari Preferences, your default will actually be DuckDuckGo.

You can use this same trick to replace Google or Bing in the Safari search bar; substitute one of these lines instead (there’s no need to use more than one):

72.94.249.35 www.google.com
72.94.249.35 www.bing.com

BIG WARNING: Using one of the two above lines will block all of Google or Bing, respectively: you will not be able to access Gmail, Google Maps, etc. This is probably not what you want. Since Yahoo Search is on a separate subdomain, using this trick with Yahoo does not have this downside (i.e., Yahoo Mail, Yahoo Maps, and the rest of Yahoo are unaffected). For this reason, it’s recommended to use the Yahoo line.

To undo the changes, simply run Nano again and remove the lines you added. Don't change anything else in the file.

Miscellany

Did you know? You can control-click any word in any app on Mac OS X and select ‘Search with...’, and it opens a search in your default Safari search engine (which you can set to DuckDuckGo!).

Were you trying to get to Google?

You—or someone who uses your computer—previously set up this computer to use DuckDuckGo instead of Google. You will not be able to access any Google services while this remains in effect.

If you want to undo this change, remove the following line from your /etc/hosts file:

72.94.249.35 www.google.com

If you don’t understand how to do this, simply bring these instructions to your local nerd. (Don’t try to explain it - print out these exact instructions on a piece of paper and hand it to them.)

Are you the nerd in question? More information about how this might have happened in the first place is available [here][1].

[1]:

Were you trying to get to Bing?

You—or someone who uses your computer—previously set up this computer to use DuckDuckGo instead of Bing. You will not be able to access any Bing services while this remains in effect.

If you want to undo this change, remove the following line from your /etc/hosts file:

72.94.249.35 www.bing.com

If you don’t understand how to do this, simply bring these instructions to your local nerd. (Don’t try to explain it - print out these exact instructions on a piece of paper and hand it to them.)

Are you the nerd in question? More information about how this might have happened in the first place is available [here][1].

[1]:

@IRainman
Copy link

Please add support for mail.ru and yandex.ru:

http://go.mail.ru/search?fm=1&q=

https://yandex.ru/search/?text=

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment