View Full Version : Changing Safari's default search to Altavista

2nd March 2004, 02:41 PM

I found this hint on macosxhints:
http://www.macosxhints.com/article.php?sto...030514035516436 (http://www.macosxhints.com/article.php?story=20030514035516436)

This hint describes a way of changing Safari's default search engine. Unlike the method which was posted a couple of days ago, this method does not block normal access to google.com. This hint assumes you are familiar with the vi text editor. First, quit Safari and make a backup copy of the application. Then follow these steps:
Launch Terminal, and use the vi editor to open the Safari executable file. The command will probably look like this for most users:
% vi /Applications/Safari.app/Contents/MacOS/Safari

Search for the text google. The first occurrence will be a string that looks like this:

This is the string that needs to be modified.

Change the string to the search engine you'd like to use. When changing this string, two things need to be kept in mind. First, the length of the new string must be the exact same length as the original. Second, you need to have two %@ sequences in the string. The second %@ should represent where your "query" would go in the URL. Here is an example. To make Yahoo! the default search engine, replace the string:


The way I figured this out was by performing a search at yahoo.com for "apple". The URL of the results page was:
<a href=\'http://search.yahoo.com/bin/search?p=apple\' target=\'_blank\'>http://search.yahoo.com/bin/search?p=apple</a>

So to keep my length constant, I needed to expand the string a little. I added a %@@ at the beginning of the URL. Putting "something@" at the beginning of a URL will not affect the loading of a site. This allowed me to take care of the first %@ sequence I needed to retain. Then I replaced apple with another %@. This is obviously where my &#39;query&#39; fits into the URL. Finally, I needed to add a bogus (unused) form field to the URL, so that the string would be the correct length. I added &a=0. So if you take a look at the original string, and the new one, the lengths of both strings are identical, as seen above.

Save your changes and quit the editor.
The next time you use Safari&#39;s search box, your favorite search engine will be used. Note that if the string you enter is not of the correct length, Safari will fail to launch.

Now, i&#39;m having trouble getting Alta vista&#39;s search to work there. Everyone on that page lists scripts for yahoo search, alltheweb search, dictionary.com search, etc... but i&#39;d like to use altavista.

The search string for altavista needs to be the same length as the google one in the safari file.

http://www.altavista.com/web/results?q=App...=mozilla-search (http://www.altavista.com/web/results?q=AppleTalk&sourceid=mozilla-search) (taken from firefox)
http://%@.google.com/%@?q=%@&ie=UTF-8&oe=UTF-8 (taken from safari)

Can anyone offer any help?

edit: and you don&#39;t need to use the terminal, you can just "Show package contents" of safari and browse to contents/macos/safari through there and edit the file in text edit.

2nd March 2004, 04:38 PM
Dude, try this string:


2nd March 2004, 04:41 PM
Excellent. *mr burns*

That worked a treat.

3rd March 2004, 11:04 AM
I find that Huevos http://www.versiontracker.com/dyn/moreinfo/macosx/14301 handles all my searching needs quite well


20th February 2008, 12:18 AM
It's been nearly 4 years since this thread was posted.

Has someone not developed an easier way to change the deafult search engine in Safari yet, without resorting to the command line or other software?

20th February 2008, 12:43 AM
yes they have its called Inquisitor


20th February 2008, 07:50 AM
David Watanabe again? No thanks.

Edit: does the original hint above still work? I get as far as the first step and I just get gibberish in the terminal window, like this -