February 25, 2004

Make Safari 1.2 use Yahoo! instead of google

  • 2004/02/25 : Ok, yesterdays version didn't work so well. This version has some checks for version in the AppleScript part now.
  • 2004/02/24 : Uses AppleScript Application instead of shell script to make it easier
Download here.

With the recent launch of the all new kick-butt Yahoo! search, I really wanted to have Safari use Yahoo! instead of Google. There have been other postings on how to do this but none have worked quite right without additional tweaking. So I have provided here a simple script with some perl pie that does the magic. As a bonus, it also changes the word "Google" in the search box when empty to say "Yahoo!".

The URL you replace the search pattern with must match the exact length of the one they compiled in. I've padded it with spaces and that works and has no ill effects that I can find. If you wanted to modify the default search parameters a little bit you would just want to make sure the length stayed the same by getting rid of the spaces. When Safari parses this search url it seems to make 3 substitutions for the 3 %@ 'variables'. The first is 'www', the second is 'search', and the third one is the query you typed in.

Download the applescript program here. Just double click on the application and it should make the changes This has only been tested with Safari 1.2 (v125) on OS X 10.3. You can make a backup copy of Safari before doing this by right clicking (Control click) on Safari in applications and select Duplicate. When a new version of Safari comes out I will have to create a new application to do the change, but hopefully Apple will make it a preference instead. This also only works on the English version of Safari. If you use another language the change will still work, but the it will still say Google in the search field and menu.

The files that are edited are:

  • /Applications/Safari.app/Contents/MacOS/Safari
  • /Applications/Safari.app/Contents/Resources/English.lproj/Browser.nib/keyedobjects.nib
  • /Applications/Safari.app/Contents/Resources/English.lproj/MainMenu.nib/objects.nib
  • /Applications/Safari.app/Contents/Info.plist
Posted by pdm at February 25, 2004 01:07 AM


great idea!

May you could send me the script saved as script instead of application? Would be great!

Thanks a lot


Posted by: Daniel at February 25, 2004 03:36 PM

What would really be different would be to be able to substitute Google for Ask or Teoma. Yahoo! uses Google to search anyway, so there can't be that much difference in the results. Even better would be able to switch search engines on the fly.

Posted by: Charles Fletcher at February 25, 2004 06:15 PM

If you right click on the Application icon, and select "Show Package Contents" you can see the actual script. Contents/Resources/Scripts/safari2yahoo.sh. Its really a gross hack.
I hope Apple makes it be a preference with a release soon.

Yahoo doesn't use Google for search, they use their own
search now (Inktomi), which also powers MSN for what
its worth.

Posted by: Phillip Moore at February 25, 2004 07:34 PM

Could this script be adjusted so that safari searches the regional googles? www.google.com.au for example?



Posted by: Paul at February 26, 2004 12:54 AM

hey i think the best way to change the safari search tab is to implement Mozilla-like keyword search directly. Instead of pointing safaris search box to google or yahoo directly, you go via a local proxy script.

that approach allows you to configure all kinds of search engines, that are selected with a keyword in front of the search e.g.

'y myquery' could search on yahoo or
'g myquery' could search on google

but the best part is that you can configure it to do sth. like e.g

'd wordquery' search on m-w.com dictionary
'i filmquery' search on imdb.com for actor or film
'a mediaquery' search on amazon.com for media

etc. completely pluggable and extendable. check http://captnswing.net/howto on how its done

Posted by: captnswing at February 26, 2004 05:01 AM


Yes, there is more than one way to do anything, unless your
Apple and their way is the only way. :-) Your way is defintaly
pretty neat. But just changing the built in search box away
from Google is good enough for some people.

There are superior products like iSeek which have really cool functionality as well, but this was intended just to get rid of
the word Google from my browser of choice and whoever else wanted to.

Posted by: Phillip Moore at February 26, 2004 08:51 AM

Hi there!
Just dlded the script and it says Can't make "1.2" into a number...
What's wrong?

Thanks for reply!


Posted by: Andy at February 26, 2004 02:54 PM

Thank you very much, Phillip! ;-)

Posted by: Daniel at February 27, 2004 12:27 PM

Hey Phil, is it a simple change to make this do google.co.uk, I had a look at the Applescript and c an't see where it is set?

Posted by: Lee Armstrong at March 16, 2004 01:58 PM