Running Concurrent Versions of iTunes

In my forensics classes, I get a lot of requests for help to run two different versions of iTunes, as different versions provide different functionality and interoperability depending on the device and firmware version. This is a quick how-to to set up a Mac with iTunes 9 and iTunes 8.1.1 in such a way that you can run a simple shell command to switch between the two, with a reboot in-between. The following files/directories are specific to each version of iTunes. As a result, you’ll need a separate copy for each version you want to switch between:

  • /Applications/iTunes.app
  • /System/Library/PrivateFrameworks/iTunesAccess.framework
  • /System/Library/PrivateFrameworks/MobileDevice.framework
  • /System/Library/PrivateFrameworks/DeviceLink.framework
  • /System/Library/PrivateFrameworks/CoreFP.framework
  • /System/Library/Extensions/AppleMobileDevice.kext
  • ~/Music/iTunes

What we’ll do is install iTunes 9, move these files into an archive, then install iTunes 8.1.1 and do the same. Using symbolic links, you’ll be able to set up an alias to simply point to the desired version of iTunes.

Install iTunes 9

Install iTunes 9 and ensure it’s operational. Don’t copy, but move all of these paths into a directory for archival. We’ll use the same method to version that Apple uses in their frameworks:

sudo mkdir -p /System/Library/iTunes/Versions/9
sudo mv /Applications/iTunes.app /System/Library/iTunes/Versions/9/
sudo mv /System/Library/PrivateFrameworks/iTunesAccess.framework /System/Library/iTunes/Versions/9
sudo mv /System/Library/PrivateFrameworks/MobileDevice.framework /System/Library/iTunes/Versions/9
sudo mv /System/Library/PrivateFrameworks/DeviceLink.framework /System/Library/iTunes/Versions/9
sudo mv /System/Library/PrivateFrameworks/CoreFP.framework /System/Library/iTunes/Versions/9
sudo mv /System/Library/Extensions/AppleMobileDevice.kext /System/Library/iTunes/Versions/9
Finally, move your iTunes music folder safely out of the way, and create a symlink to it from our new directory:
mv ~/Music/iTunes ~/Music/iTunes.9
sudo ln -s ~/Music/iTunes.9 /System/Library/iTunes/Versions/9/iTunes

Once you’ve completed this, be sure to reboot your computer.

Install iTunes 8.1.1

After rebooting your computer, download and install iTunes 8.1.1, or whatever other version you’d like to run. Ensure that it is working correctly (perhaps by doing a forensic recovery). When you are satisfied, move these files as well into a separate folder:

sudo mkdir -p /System/Library/iTunes/Versions/8.1.1
sudo mv /Applications/iTunes.app /System/Library/iTunes/Versions/8.1.1
sudo mv /System/Library/PrivateFrameworks/iTunesAccess.framework /System/Library/iTunes/Versions/8.1.1
sudo mv /System/Library/PrivateFrameworks/MobileDevice.framework /System/Library/iTunes/Versions/8.1.1
sudo mv /System/Library/PrivateFrameworks/DeviceLink.framework /System/Library/iTunes/Versions/8.1.1
sudo mv /System/Library/PrivateFrameworks/CoreFP.framework /System/Library/iTunes/Versions/8.1.1
sudo mv /System/Library/Extensions/AppleMobileDevice.kext /System/Library/iTunes/Versions/8.1.1
Finally, move the version 8 iTunes music folder safely out of the way, and create another symlink to its new home:
mv ~/Music/iTunes ~/Music/iTunes.8.1.1
sudo ln -s ~/Music/iTunes.8.1.1 /System/Library/iTunes/Versions/8.1.1/iTunes

Create Symlinks

At this point, you should have both versions of iTunes stored in /System/Library/iTunes/Versions, in a separate directory. You’ll now need a series of symlinks connecting the original file locations to these new locations. This is done by creating a single master symlink named “Current” which points to whatever version of iTunes you want to be active at any given time. Execute the following commands to create this link, as well as the commands to create symlinks from the original file locations:

sudo ln -s /System/Library/iTunes/Versions/8.1.1 /System/Library/iTunes/Versions/Current
sudo ln -s /System/Library/iTunes/Versions/Current/iTunes.app /Applications/iTunes.app
sudo ln -s /System/Library/iTunes/Versions/Current/iTunesAccess.framework /System/Library/PrivateFrameworks/iTunesAccess.framework
sudo ln -s /System/Library/iTunes/Versions/Current/CoreFP.framework /System/Library/PrivateFrameworks/CoreFP.framework
sudo ln -s /System/Library/iTunes/Versions/Current/MobileDevice.framework /System/Library/PrivateFrameworks/MobileDevice.framework
sudo ln -s /System/Library/iTunes/Versions/Current/DeviceLink.framework /System/Library/PrivateFrameworks/DeviceLink.framework
sudo ln -s /System/Library/iTunes/Versions/Current/AppleMobileDevice.kext /System/Library/Extensions/AppleMobileDevice.kext
sudo ln -s /System/Library/iTunes/Versions/Current/iTunes ~/Music/iTunes

Create Aliases

Once complete, you’ll have successfully mapped your active copy of iTunes. Now all you’ll need are a couple aliases to switch between versions. Add the following text, to your .profile:

alias itunes9="sudo ln -shf /System/Library/iTunes/Versions/9 /System/Library/iTunes/Versions/Current"
alias itunes811="sudo ln -shf /System/Library/iTunes/Versions/8.1.1 /System/Library/iTunes/Versions/Current"

To switch between a different version of iTunes, simply run the corresponding shell alias, then reboot your computer.

Upgrading

As of late, iTunes appears to upgrade across symlinks, meaning it won’t destroy any of your mappings. Just make sure your currently active version of iTunes is the one you want to upgrade. Should Apple change their upgrade process and begin destroying symlinks, you’ll need to then move the new folders back into the /System/Library/iTunes/Versions/9 directory and recreate your symlinks.

About Jonathan Zdziarski

Respected in his community as an iOS forensics expert, Jonathan is a noted security researcher, penetration tester, and scientist. Author of many books ranging from machine learning to iPhone hacking and software development, Jonathan frequently trains many federal and state law enforcement agencies in digital forensic techniques and assists law enforcement and the military in high profile cases. Jonathan is also inventor on several US patent applications, father of DSPAM and other language classification technology, and an App Store developer. All opinions expressed on this website are the author's own. Follow Jonathan on Twitter: @JZdziarski
This entry was posted in Forensics, General, iPhone. Bookmark the permalink.

Leave a Reply