iTunes shared local Library

« Claria/Gator VP appointed to DHS Data Privacy Committee | Main | Soured on Pot au Feu »

I recently helped a friend reinstall his Mac from the ground up. He was having no end of trouble with conflicts between his new Wacom tablet's drivers and Norton Anti-Virus (worst AV program ever). While we were at it, we partitioned his drive into system and data partitions so if he has any trouble in the future he won't have to worry about getting all his data backed up.

We decided to put his iTunes music on the data drive and make it shareable between him and his partner. This requires a little tweaking of permissions and adding a group, but will be worth it in the end.

Full instructions after the jump.

After partitioning the drive and reinstalling OS X, you will have a system partition and a data partition. Having separate partitions is not required for this, but it's just how we did it.

Now you've got the files in the right place, but they're still only accessible to one user. Here's where things get a little complicated. We need to make a group for the music users. This will allow us to set permissions on all the directories and files so that the members of the group will be able to make changes (create playlists, update ID3 tags, etc.)

NetInfo Manager

Now you have the group created. All that's left is taking care of permissions on the Music directory. I have created a script that will run once a day to handle this. It needs to be installed with permissions 755 in /etc/periodic/daily (get a Unix knowledgeable friend to help if you have no idea what that means.) This script will go through your music directory and set the group ownership to itunes-users and set all the directories and files read/write for that group. This will allow all of the itunes-users to add files and modify ID3 tags.

#!/bin/bash
# 
# iTunesShareFix
# 
# iTunes Shared Library Permissions Fixer
#
# This periodic script will fix the permissions of a directory tree to
# allow multiple users to shared read and write access that tree. This
# is most useful for sharing an iTunes music library between multiple
# users on a single Mac.
#
# Install this script with permissions 755 into /etc/periodic/daily
# and it will run once a day as long as your Mac is running at night.
#
# If your mac if off at night (putting your powerbook to sleep for 
# example) you should get the anacron package from:
# http://www.alastairs-place.net/anacron.html
#
#
###############################################################################
# Variables
###############################################################################
#
# SHAREGRP - All users that should have access to the library will 
# need to be part of this group

SHAREGRP="itunes-users"

# SHAREDIR - The top level directory under which everything will be 
# read and write accessible for members of SHAREGRP. Be sure to 
# include the directory that holds the "iTunes Music Library.xml" 
# files so that everyone has the ability to make playlists.
# 

SHAREDIR="/Path/To/Your/Music"

################################################################################
# Don't Make any changes below here unless you know what you're doing!
################################################################################

find "$SHAREDIR" -type d -exec chmod 775 "{}" \;
find "$SHAREDIR" -type d -exec chgrp $SHAREGRP "{}" \;
find "$SHAREDIR" -type f -exec chmod 664 "{}" \;
find "$SHAREDIR" -type f -exec chgrp $SHAREGRP "{}" \;

This script wouldn't be required if there was some way to run iTunes with a umask of 002. If anyone knows how to do that, I'd really like to hear about it.

Posted by John on March 13, 2005