Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Change Safari's default search engine Web Browsers
This hint describes a way to change one of Safari's built-in search engines (Google/Yahoo/Bing) into a custom one, without the use of any plugins/add-ons/extensions. It involves carefully editing one of Safari's binary (much like the previous hint.)

Go to /System/Library/PrivateFrameworks/Safari.framework/Versions/A/ and save the file named 'Safari' somewhere safe. If something goes wrong while editing, it's just a matter of copying that back (tested myself).

Do the same for this file /Users/USER/Library/Safari/Configurations.plist.signed.

Open 'Configurations.plist.signed' with any text editor and erase everything in it, making it blank. Save it, and then right-click to 'Get Info,' and tick the 'Locked' box.

Now for the binary I recommend a hex editor, I used the free HexFiend.).

Open the /System/Library/PrivateFrameworks/Safari.framework/Versions/A/Safari with your tool of choice. If you search google/yahoo/bing you'll find several strings, I decided to edit the Bing one because It was the one with the least amount of strings to edit, and as my new search engine I choose DuckDuckgo.

Search for:

http://www.bing.com/search?q={searchTerms}&form=APMCS1

And replace with:

https://duckduckgo.com/?q={searchTerms}

Note that you have to replace the old string with one of the same length, otherwise Safari will crash, and since the new one is shorter, add blank spaces to the end. It's a bit easier if using a hex editor.

Search for:
68 74 74 70 3A 2F 2F 77 77 77 2E 62 69 6E 67 2E 63 6F 6D 2F 73 65 61 72 63 68 3F 71 3D 7B 73 65 61 72 63 68 54 65 72 6D 73 7D 26 66 6F 72 6D 3D 41 50 4D 43 53 31
And replace with:
68 74 74 70 73 3A 2F 2F 64 75 63 6B 64 75 63 6B 67 6F 2E 63 6F 6D 2F 3F 71 3D 7B 73 65 61 72 63 68 54 65 72 6D 73 7D 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
I also tried editing the suggestions string to DDG's but It didn't work, Safari wouldn't display the suggestions with the new string, and since I didn't want suggestions from Bing I just blanked out the http://api.bing.com/asjson.aspx?query={searchTerms}&form=APMCS2 string.

Search for:
68 74 74 70 3A 2F 2F 61 70 69 2E 62 69 6E 67 2E 63 6F 6D 2F 61 73 6A 73 6F 6E 2E 61 73 70 78 3F 71 75 65 72 79 3D 7B 73 65 61 72 63 68 54 65 72 6D 73 7D 26 66 6F 72 6D 3D 41 50 4D 43 53 32
And replace with:
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
Save It, open Safari.app and select Bing (I wasn't able to change the search bar label, if someone finds a way, please post!), but now instead of Bing, your searches will go to DDG.

[crarko adds: I haven't tested this one. Be certain you have known good backups of any of these files that you edit, and also be aware that the next time the System or Safari is updated, there may be issues.]
    •    
  • Currently 3.83 / 5
  You rated: 2 / 5 (6 votes cast)
 
[21,975 views]  

Change Safari's default search engine | 7 comments | Create New Account
Click here to return to the 'Change Safari's default search engine' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Change Safari's default search engine
Authored by: drudus on Feb 14, '12 08:30:19AM

Seems easier & safer to edit the hosts file to direct the Yahoo option to duckduckgo.

eg add
184.72.115.86 search.yahoo.com
to /etc/hosts/ as described in duckduckgo's help
http://help.duckduckgo.com/customer/portal/articles/255650

It will affect all users on the machine that select Yahoo as the search engine, but it is less likely to break with OS & Safari updates.



[ Reply to This | # ]
Change Safari's default search engine
Authored by: astack on Feb 14, '12 10:07:30AM

This is a great hint, if nothing else for explaining how to get rid of automatic suggestions in the search field box. (I know what I want to search for, the search engine does not and suggestions are distracting in addition to not being helpful.)

Wonderful, thank you!



[ Reply to This | # ]
Change Safari's default search engine
Authored by: apikoros on Feb 14, '12 02:07:44PM

It's easier to just use the freeware Glims.



[ Reply to This | # ]
Change Safari's default search engine
Authored by: Brethil on Feb 15, '12 03:09:53AM

I'm using the /etc/hosts & Yahoo method, and I'm just wondering if anyone has changed the default search string (e.g. "Yahoo!") to something else, the string is probably just in a Safari .nib right?



[ Reply to This | # ]
Change Safari's default search engine
Authored by: talm on Jul 15, '12 06:16:52AM

Is there a way to change default search string (e.g. "Yahoo!") to the customer seach engin i choose ?



[ Reply to This | # ]
Change Safari's default search engine
Authored by: mattswain123 on Aug 04, '12 01:43:10PM
I just created an extension to do this without hacking around:
http://www.macosxtips.co.uk/extensions/#anysearch
It only works with the new "omnibar" in Safari 6+.

[ Reply to This | # ]
Change Safari's default search engine
Authored by: mmphosis on Aug 29, '13 09:57:02PM

Thanks for the information!

I was able to search for "Bing" and replace it with "DDGo" to make the labels appear as "DDGo". There were two occurrences of "Bing" in the executable on my Mac...

$ hexdump -vC -s 0x5dd0c1 -n 4 Safari-copy
005dd0c1 42 69 6e 67 |Bing|
005dd0c5
$ hexdump -vC -s 0xf9051d -n 4 Safari-copy
00f9051d 42 69 6e 67 |Bing|
00f90521


[ Reply to This | # ]