Sunday, June 8, 2008

Sharing iPhoto Library between users

I recently started using Mac OS X again. I haven't used it since it first came out. I really like what I am seeing so far. However, I quickly found out that iPhoto is set up by default to have individual Libraries for iPhoto. This is not what I want. I want for me to be able to update the iPhoto Library and my wife to be able to update the same iPhoto Library when she logs into the computer. The reason is simple. We use iPhoto for the entire family. We don't keep individual copies. That seems insane to me.

You can always try this method, but I don't like it. You can hold down the option key when you click iPhoto on the Dock. This will have iPhoto ask you to Create a new Library or Choose an Existing Library. You should be able to create it in /Users/Shared/Pictures/iPhoto Library, and then for the other user point it to the same location instead of creating a new one. I have not tested this, but I expect it would work.

The thing is, I still wanted all things to appear to iPhoto and other applications that I am using my own iPhoto Library and see it in the /Users/Shared/user1/Pictures/iPhoto Library directory. I don't know if there is a good reason, but it seems like there will be less trouble in the future.

To accomplish this we can take advantage of what is called a symbolic link. It is different than the Alias feature in OS X.

Create a symbolic link each Pictures directory that points to the iPhoto Library for the Shared user.

Here is a sample of what you will need to do, probably from the root account

mkdir /Users/Shared/Pictures/iPhoto\ Library


sudo ln -s /Users/Shared/Pictures/iPhoto\ Library/ /Users/user1/Pictures/iPhoto\ Library


sudo ln -s /Users/Shared/Pictures/iPhoto\ Library/ /Users/user2/Pictures/iPhoto\ Library


NOTE: The example above has a space in the directory name. When using the shell, a back slash is need before the space to escape it. Much like many programming languages.

After that you will need to make sure user1 and user2 have Read / Write permissions on the /Users/Shared/Pictures/iPhoto Library directory. Otherwise, you will get permission or file locked error.

I'm sure there is a command to do this, but the UI makes it easy by getting info in Finder on the /Users/Shared/Pictures/iPhoto Library directory.

I would love feedback on this solution. I fiddled with the syntax to get it to work, and I think I got what I actually did written accurately here.


8 comments:

Anonymous said...

Im interested in a similar solution - can you give an update on how this is working for you?

Brent V said...

I have not had any issues with the solution. It seems to work well. I like it. :)

Brent

PJ Geraghty said...

This works pretty well, though sometimes you have to play with the permissions a bit (BatCHMod is the easiest way to do it).

And if you don't like command line stuff (I don't), you can use a symbolic link contextual menu plugin.

Brent V said...

I imagine permissions could be an issue. I put the real files in /Users/Shared, and that seemed to avoid the issue. BatCHMod sounds nice. I tried contextual menu plugins and I found them to be confusing. I guess I like the command line too much. ;)

Mrs. W said...

I am new to Macs. Would adding an Alias to "shared" not work. It does seem like a waste of space (40GB). How do you access the root account?

Brent V said...

Kari,

An alias may work. I don't remember why, but it seems to me that an alias would NOT work. It may also depend on what version of OS X you have. Apple changed the way they behave as of v10.2. Here is the link that describes the difference:

http://developer.apple.com/documentation/MacOSX/Conceptual/BPFileSystem/Articles/Aliases.html

On Leopard, I seem to remember that alias didn't work. I also, like creating the links from the command line so that I can do it for all the users that will be sharing that library without much work. It is very programmatic.

Your root account is the administration account you set up when you setup OS X. It is likely that it is the same user you log in with if you only have one account on the machine. Really, all you have to do is execute the commands I showed that start with sudo and that will ask you for an administration password. Try your password. It may work. If not, there is someone that should have admin rights that can access the mac.

PJ Geraghty said...

As Brent mentioned, an alias might work, but a symlink will work. I too seem to recall that an alias did not work in the past, which is why I started using a symlink and continue to do so, with success. The file structure may have changed in subsequent OS X versions allowing an alias to work, but I wouldn't count on it.

The command line scares me... one wrong "rm" typo can ruin your whole day! Whenever I can find a GUI that will do what I want, I take it over the command line.

Brent V said...

Kari,

Let us know if you get the Alias to work.

PJ,

Thanks for the feedback.