Sunday, December 8, 2024

Two Safari’s

Share

Look carefully at the image below. You see two Safari icons in the Dock (one third from the left, the other next to the app/doc divider), and also two Safari browsers open, both on the same site and page, but displaying very differently. The Font preferences are also shown, and this is what makes them different.

Note that having two Safari’s in the dock is simple: just run /Applications/Safari.app/Contents/MacOS/Safari in a terminal Window. Those will share the same preferences and bookmarks though.

Although I am using Safari as the example here, this technique can actually be applied to any Mac OS X application.

Why would you want to do this? Well, for one reason so that you can have separate preferences or bookmarks. Another reason is because of application crashes which take down all your open Windows. For example, I often do things in Terminal that can crash all my terminal sessions, but not if I keep separate instances of Terminal open. You might want to do this with an Email application to keep two totally separate accounts – there are all kinds of reasons.

The copy

The first step is to make an identical copy of Safari. We’ll use “ditto” for this because we may need to copy resource forks.

cd /Applications
sudo ditto Safari.app Safari2.app
cd Safari2.app/Contents
sudo mv MacOS/Safari MacOS/Safari2

Now we need to edit Info.plist. Basically, any place it says Safari will be changed to Safari2. The most important change is the

<key>CFBundleIdentifier</key>
&nbsp&nbsp&nbsp <string>com.apple.Safari2</string>

because that is your ~/Library/Preferences location, and we need it to be different for these two versions. Here are the other places:

<key>CFBundleExecutable</key>
&nbsp&nbsp <string>Safari2</string>
<key>CFBundleName</key>
&nbsp&nbsp <string>Safari2</string>

If you aren’t sure whether something needs to be changed, leave it alone and try running the app. If it works as you expect, then you are fine.

One thing that won’t change with Safari is its default home page. That’s because Safari looks instead in ~/Library/Preferences/com.apple.internetconfig.plist for that information.

Once this is done, you can run the new Safari2 and if you change its preferences, that has no effect on the original Safari.

A.P. Lawrence provides SCO Unix and Linux consulting services http://www.pcunix.com

Table of contents

Read more

Local News