Multiple instances of Safari with independent cookie databases?

Hippo Man

Hippo Man
Is there any way to bring up multiple instances of Safari, each one with a completely independent cookie database?

I have several Gmail accounts, and I want to simultaneously log in to all of them in different browser windows. However, since Safari manages a central cookie database, I can't log into one of these Gmail accounts without signing out from another.

With separate Safari instances that mantain separate cookie databases, I could simultaneously keep multiple Gmail windows open.

Thanks for any suggestions or tips.
.​
 
Sadly, that's not really possible AFAIK. You could use separate Mac OS X user accounts, but that might be a hassle as well...
 
But then again ...

I think there's something to your idea. What if I create a few user ID's and log into Gmail with a different email address for each of these ID's?

Then, under my main user ID, use sudo to start up Safari under a different one of these user ID's for each instance. When I go to Gmail, each one will have a different cookie database.

Do you think that would work?
.​
 
That's an interesting idea. I never thought about it, but I just tested it and it IS possible to have GUI programs from different users up at once. I just got two copies of TextEdit open like so:
Code:
su <second_account_name>
/Applications/TextEdit.app/Contents/MacOS/TextEdit
I did get this warning, though:
Code:
*** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x4003, name = 'com.apple.TextEdit.ServiceProvider'
That usually happens when you have two instances of an application open at once, but it doesn't normally happen with different user accounts. Maybe it's not a sign of a problem, though.

Of course, it might be simpler to enable POP/IMAP access in Gmail and load all your accounts into the email client of your choice. That would avoid the mess of having multiple Safari instances taking up RAM and cluttering up your Dock.

I also use multiple gmail accounts, and I've wondered about a good way to manage them, too. I've found that you can access the RSS feeds by using HTTPS authentication (no cookies required), like so: https://<yourname>:<yourpassword>@mail.google.com/mail/feed/atom . I haven't been able to reach my inbox like this, but there might be some way. My main concern about this is security. I know that even the URL is encrypted when using HTTPS, but I'm not sure if it's really equivalent, security-wise, to the normal method.
 
Thank you.

I was previously using IMAP access to Gmail, but it's a lot slower and less efficient than going directly to Gmail via a browser. Plus, I miss out on some of the features of Gmail this way.

I just now tried this with Safari, and it works! Here's how I start up Safari using sudo (it's a shell script):
Code:
#!/bin/sh
/usr/bin/sudo -H -u user0 /bin/sh -c "cd; /Applications/Safari.app/Contents/MacOS/Safari &"
exit 0

I first logged into that user ID and invoked Safari directly. It seems to be necessary to do this one initial time for each user that I want to set up in this way.

Onward!
.​
 
I found a flaw in this different-user-ID approach. When I have a Safari instance running under another user ID, I can't copy and paste text from it to any program running under my current user ID. It seems like the paste buffer is somehow owned by the user who is running the program, not the user who is managing the desktop.

Am I assessing the situation correctly? In any case, is there something I can do in order to copy and paste text between applications that are running under different user ID's?

Thanks in advance.
.​
 
A multi-step process, but I don't see why it wouldn't work (and yes, I think you're assessing the copy-paste problem correctly):

1) Copy text from Safari.
2) Open TextEdit (with the same user account as Safari was running under).
3) Paste text.
4) Save document.
5) Open document with user account that you wish to copy the text.
6) Paste into that user's Safari instance.
 
Did you know that gmail has rss feeds?

You can subscribe to your accounts with a feed reader like Vienna and check them all at once.
 
Did you know that gmail has rss feeds?

You can subscribe to your accounts with a feed reader like Vienna and check them all at once.
Yes. I know that. I can also access Gmail via IMAP.

However, this is not a suitable solution for me, because I want to access all of Gmail's features, not simply get a feed for the email. In addition, I've found that the IMAP and RSS access is slower and less reliable under Gmail.

Furthermore, this is a more general issue and it doesn't just pertain to Gmail. There are other sites on which I have multiple logins, and it would make it a lot easier to deal with these if I could have separate browser instances with separate cookie databases, so I can keep connected to more than one of these at a time. One such cases is a large site on which I am a developer. We have several blogs on which I have to make parallel changes under different user ID's (admin, non-admin user 1, non-admin user 2, etc.), and without separate cookie DB's, I have to continually log out and re-log in when I'm making these changes. This is a PITA.
.​
 
Last edited:
A multi-step process, but I don't see why it wouldn't work (and yes, I think you're assessing the copy-paste problem correctly):

... etc. ...
Hi, and thanks! :)

I tried that, and sadly, it doesn't work. It turns out that the problem isn't the location of the pasting target. The copy doesn't end up capturing the text at all, and the paste buffer remains empty after the attempted copy. I can't even copy from the other-user-ID Safari window and paste into another section of that same Safari window.

I'm pretty sure that the reason for this is that the paste buffer is owned by the current user, and that software running under other user ID's somehow doesn't have access to it. I've been hoping that there's some trick to get around this limitation, but I'm no longer feeling optimistic about this.
.​
 
Last edited:
In another forum, someone reminded me of a better way to solve this multiple cookie database problem. As long as I'm willing to use Firefox instead of Safari (and I am), I can set up multiple Firefox profiles under a single user ID. Each profile manages a different set of Firefox attributes, including a distinct cookie database. Here's how to do it:

1. Install Firefox.

2. Open a Terminal window and type the following command:
Code:
/Applications/Firefox.app/Contents/MacOS/firefox -ProfileManager
Replace /Applications/Firefox.app with the pathname of the location in which the Firefox application is installed.

This starts a dialog which lets you create new Firefox profiles.

3. Create as many of these profiles as you need. Assume for the sake of this discussion that they're called profile0, profile1, profile2, etc.

4. Create a shell script that looks like this:
Code:
#!/bin/sh
[ $# -gt 0 ] && {
      set -- -P "${@}"
}
/Applications/Firefox.app/Contents/MacOS/firefox -no-remote -browser -P "$@" &
exit 0
You can name this shell script anything you want. Assume it's called runFirefox. Again, replace /Applications/Firefox.app with the Firefox application's install location.

5. Issue this command in the Terminal window to ensure that the shell script is executable:
Code:
chmod +x runFirefox
6. Open up Script Editor and create the following AppleScript:
Code:
do shell script "/path/to/runFirefox profile0 1>/dev/null 2>&1"
... where /path/to is the pathname of the directory in which you created this shell script.

You should use any of the Firefox profile names you created above instead of profile0.

7. In the Script Editor menu, select File->Save As and save this AppleScript with a suitable name in an appropriate location. For example, you could call it Firefox-profile0. Make sure that the File Format you save it under is Application, and that none of the Options are selected.

Now, you can run this AppleScript from the Finder or drag it to the dock.

Repeat steps 6 and 7 for all the Firefox profiles.

PS: I edited this message and made a change to step 6. I added " 1>/dev/null 2>&1" to the end of the do shell script command.
.​
 
Last edited:
It turns out that this multi-profile methodology also works for the Camino browser, which is a stripped down version of Firefox that runs under MacOS. Here's how to set up Camino with multiple profiles:

1. Install Camino (download here: http://download.mozilla.org/?product=camino-1.6&os=osx&lang=en-US).

2. Open a Terminal window and type the following command:
Code:
/Applications/Camino.app/Contents/MacOS/Camino -ProfileManager
Replace /Applications/Camino.app with the pathname of the location in which the Camino application is installed.

This starts a dialog which lets you create new Camino profiles.

3. Create as many of these profiles as you need. Assume for the sake of this discussion that they're called profile0, profile1, profile2, etc.

4. Create a shell script that looks like this:
Code:
#!/bin/sh
profileTop=${HOME}/etc/camino
if [ $# -gt 0 ]
then
  export CAMINO_PROFILE_DIR="${profileTop}/${1}"
  shift
else
  unset CAMINO_PROFILE_DIR
fi
/Applications/Camino.app/Contents/MacOS/Camino "$@" &
exit 0
You can name this shell script anything you want. Assume it's called runCamino. Again, replace /Applications/Camino.app with the Camino application's install location.

5. Issue these two commands in the Terminal window to create the Camino profiles directory and to ensure that the shell script is executable:
Code:
mkdir -p $HOME/etc/camino
chmod +x runCamino
6. Open up Script Editor and create the following AppleScript:
Code:
do shell script "/path/to/runCamino profile0 1>/dev/null 2>&1"
... where /path/to is the pathname of the directory in which you created this shell script.

You should use any of the Camino profile names you created above instead of profile0.

7. In the Script Editor menu, select File->Save As and save this AppleScript with a suitable name in an appropriate location. For example, you could call it Camino-profile0. Make sure that the File Format you save it under is Application, and that none of the Options are selected.

Now, you can run this AppleScript from the Finder or drag it to the dock.

Repeat steps 6 and 7 for all the Camino profiles.
.​
 
Last edited:
This multi-profile methodology also works for the SeaMonkey browser, which is a version of Mozilla. Here's how to set up SeaMonkey with multiple profiles:

1. Install SeaMonkey (download here: http://download.mozilla.org/?product=seamonkey-1.1.13&os=osx&lang=en-US).

2. Open a Terminal window and type the following command:
Code:
/Applications/SeaMonkey.app/Contents/MacOS/seamonkey -ProfileManager
Replace /Applications/SeaMonkey.app with the pathname of the location in which the SeaMonkey application is installed.

This starts a dialog which lets you create new SeaMonkey profiles.

3. Create as many of these profiles as you need. Assume for the sake of this discussion that they're called profile0, profile1, profile2, etc.

4. Create a shell script that looks like this:
Code:
!/bin/sh
[ $# -gt 0 ] && {
  set -- -P "${@}"
}
/Applications/SeaMonkey.app/Contents/MacOS/seamonkey -nosplash "$@" &
exit 0
You can name this shell script anything you want. Assume it's called runSeamonkey. Again, replace /Applications/SeaMonkey.app with the SeaMonkey application's install location.

5. Issue this commands in the Terminal window to ensure that the shell script is executable:
Code:
chmod +x runSeamonkey
6. Open up Script Editor and create the following AppleScript:
Code:
do shell script "/path/to/runSeamonkey profile0 1>/dev/null 2>&1"
... where /path/to is the pathname of the directory in which you created this shell script.

You should use any of the SeaMonkey profile names you created above instead of profile0.

7. In the Script Editor menu, select File->Save As and save this AppleScript with a suitable name in an appropriate location. For example, you could call it SeaMonkey-profile0. Make sure that the File Format you save it under is Application, and that none of the Options are selected.

Now, you can run this AppleScript from the Finder or drag it to the dock.

Repeat steps 6 and 7 for all the SeaMonkey profiles.
.​
 
Back
Top