Sharing one iTunes library amongst multiple users on Mac OS X

Last night, I set up iTunes so that it uses one library for all my accounts on my mac, and figured to do a little writeup.

Let’s say you have an account, jam, and want it to use the iTunes library from the account bees. I assume you’ve already got bees’ iTunes stuff set up how you like.

There are two key insights:
a) both accounts are, by default, part of the staff group
b) your iTunes library is, at its heart, just a folder on the file system

In jam:

1. Open a console
2. cd ~/Music
3. remove the iTunes folder and ln -s ~bees/Music/iTunes .

That’s the initial, basic setup done. If you open iTunes, though, you’ll find that you can’t write to anything from the jam account, so you can’t actually do useful things, like opening iTunes.

However! From the jam account, open a Terminal and:

su - bees

Now, in the bees terminal:

cd ~/Music/iTunes
ls -l

Now, the owner of each file is bees:staff, right? And bees has the correct permission for writing everywhere, right? So, use chmod to replicate the user permissions to the group permissions for every folder, and for your library files and whatnot:

-rwxrwx---@  1 bees  staff    806136  1 Aug  2008 Temp File.tmp
-rw-rw-r--@  1 bees  staff   4628440 17 Oct 08:32 iTunes Library
-rw-rw-r--   1 bees  staff   1122304 17 Oct 08:31 iTunes Library Extras.itdb
-rw-rw-r--   1 bees  staff  83341312 13 Oct 15:50 iTunes Library Genius.itdb
drwxrwx---  69 bees  staff      2346 16 Oct 12:17 iTunes Music/
-rwxrwxr-x@  1 bees  staff  22701215 16 Oct 13:22 iTunes Music Library.xml
-rwxrwx---@  1 bees  staff         8 17 Oct 08:31 sentinel

Now, cd iTunes\ Music/ and do the same trick here, then cd into Music and Podcasts and those guys and do the same trick there.

Of course, it’s directories which need their permissions changing, not files, so if you want to you can always find ./ -type d -exec chmod 775 {} \; from the iTunes directory if you want to be quick about the majority of this. After that, go find the files which need their permissions changing too, like the iTunes library xml file, and you’re rockin’ and rollin’.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s