Custom User-Agent Safari
Safari offers a pretty nice Developer toolbar (once enabled under Safari->Preferences->Advanced->Show develop menu…). As part of the developer toolbar they offer a User-Agent switcher to allow you to seemingly be using a different browser. Now, if you’re familiar with the User-Agent Switcher on Firefox, you know you can add additional/custom user agents. However, Safari doesn’t make it as easy to add additional/custom agents. Rest assured, there is still away.
The file you will be looking for is:
/Applications/Safari.app/Contents/Resources/UserAgent.plist
What I have done is copy this file off to my home directory. Open the file with the Property List Editor (provided with Apple’s developer tools). I will add 2 entries into this file. One to give a nice divider for my custom agents and another for the Google Bot Agent.
For the divider:
- Select the last ‘Item’ (be sure the ‘Item’ is not expanded) and click the ‘+’ sign to add a new ‘Item’
- Change this ‘Item’ to a ‘Dictionary’ under the ‘Type’ column.
- Expand this ‘Item’ and press the ‘Add sub-item button’ (replaced the ‘+’ sign after expanding)
- Rename this sub-item’s key to ‘separator’, change the type to Boolean, and select the Value checkbox.
![]()
For the new User-Agent:
- Add a new ‘Item’ as you did in step 1 above.
- Change this ‘Item’ to a ‘Dictionary’ under the ‘Type’ column.
- Expand this ‘Item’ and press the ‘Add sub-item button’ (replaced the ‘+’ sign after expanding) 4 times.
- Set the key, type, value for each as follows:
- name, String, Google Bot
- version, String, 2.1
- platform, String, Mac (not sure if this matters or not)
- user-agent, String, Googlebot/2.1 (+http://www.google.com/bot.html)

Save this file. Quit Safari. Replace the original with the new one.
$ sudo su -
# rm /Applications/Safari.app/Contents/Resources/UserAgents.plist
# cp /Users/derek/UserAgents.plist /Applications/Safari.app/Contents/Resources/
Fire Safari back up and there you have it. A new custom user-agent. Repeat as necessary to add more.
