Move music library

i’ve got the media for my music library on an external disk and it’s running out of space. so i want to move it to a new external disk, twice the displacement. but at the same time, i want to move my entire music library. (additionally i’m moving overseas soon and need to temporarily move my music library onto a laptop whilst wanting to keep play data &c up-to-date.)

there are some issues: one problem is my existing library is old with cruft from a decade ago. here’s the media:

note that some of the timestamps are very old. is that stuff still being used? i can’t tell. what about the file and folder names?

another problem is a Music subfolder in Music on my system disk with a “Music Library.musiclibrary” which appears to be the actual metadata for my tunes. that looks like this:

if that’s actually what’s going on, i want to consolidate the mess. but exactly how? has anyone successfully done something like this? hints or instructions gladly welcomed.

thanks

1 Like

First, let me state that I still use iTunes on Catalina not the Music app (thanks to Retroactive) but the process should be the same.

When I upgraded my MacOS systems in the past, I always installed them on a new partition and then copied the whole iTunes folder to the new user music folder so that everything stayed the same. Of course, if the iTunes version is newer it is going to update those database files (not the music files) but it should all be there. I keep my actual music files (aiff and mp3) on separate hard drives which sounds similar to what you described. But I never changed the location of those files. If you’re moving your actual music files onto a laptop, then after copying those and running iTunes/Music, you are going to have to add them to the library under the File menu. I don’t download any music as mine are all from CD’s or digitized records so I can’t say if purchased music affects the process. I don’t have any files on my computer that say Music Library as in your second screen shot so not sure about that but that could be from the Music app.

Your system looks very similar to mine. Started running iTunes and later migrated to Music.

The contents of ~/Music/Music/Music Library.musiclibrary is the database used by the Music app.

The actual audio files remain in their legacy location. In your case, ~/Music/iTunes/iTunes Media.

The remaining files in ~/Music/iTunes (the XML, ITL and other related files) are leftover database files from when you were running iTunes.

As for how to move the music to a new device, the best way is:

  • Create a folder on the new device, where you want to put everything
  • Launch Music
  • Go to Preferences → Files
  • Click the Change… button and select the new location
  • Click OK
  • From the menu-bar, select File → Library → Organize Library…
  • Check Consolidate files and click OK

Music will copy all of your media files (wherever they may be) to the new location. Let it finish (it might take a long time).

When it is done, Music will be using the media files from the new location. You can confirm this (for single files), by clicking on a song/video and do a “Get Info” (CMD-I) and look at the File tab. The “location” line will show where the app expects the file to be.

Once you’re confident that everything is working from the new location, you can delete the media files from the old location.

3 Likes

Can the new location be an external drive?

that looks really good, david. thanks. remaining question is, will the organize library process move the database to the new disk as well?

my media files are already on an external disk (albeit one that’s running out of space) so the answer is yes.

Yes. If the drive is not mounted when you launch Music, I think you’ll see broken-link icons in the UI, but the database won’t break. At least this was the case when I did this years ago with iTunes.

No. The database (in ~/Music/Music) will always live in your home directory, but the database is small enough that it shouldn’t matter.

For example, on my system (14,678 items), the database is about 20 MB, while the media folder is about 71 GB.

I don’t think his files are in the legacy location as you stated since he has an external drive.

The consolidate function is more useful if files are on different drives but it was stated that they are on an external drive so it would be easier to copy the whole folder of media and use add to library for a fresh start.

Yes, but…

If you just copy all the media and create a new library, you will lose the contents of the old database. Any metadata not stored in the media files (may include artwork and star-ratings and maybe other data depending on the file format of each item) will be lost. So will playlists.

Consolidation copies the media files to a new location but preserves the database so nothing else is lost.

I wouldn’t start from scratch with a new library unless there is something broken that can’t be fixed any other way.

Good points you mentioned. However, if your metadata is embedded correctly then all of that including album art will cross over to the new database. Album art should always be embedded if you expect those files to work with other programs or players such as in a car system. Playlists are easy to export and import. I don’t bother with star ratings so I guess it depends on what you use or value.

for me, playlists and star ratings are not easily exportable, so @Shamino’s advice about exporting the database is useful. I’ve also found that metadata is like 85% embedded, but if you have a lot of music, 15% is still a lot of files that will have incorrect data that will need to be corrected. I haven’t had to (yet) do this with Music, so maybe this has improved since iTunes…

That’s how it should work in theory, but practice is somewhat different.

Album art often exists only in the database. Especially for purchases from the Music Store - where one image will be downloaded for an entire album. This doesn’t break my car usage because I sync my music to an iPod Touch, which gets all the data from the database (and can then present it to the car via USB).

And if you have music in many formats (e.g. MP3, AAC, WAV, others), you will find that not all formats support all of the metadata that Music supports. For these files, any metadata not supported by the file exists in the database.

Some metadata I use extensively includes the Grouping field, where I store a comma-separated list of keywords (sub-genres and instruments played) for use by smart playlists and the various Sort… fields (especially for Artist and Composer) so the music will sort alphabetically by last name.

I use star ratings with a set of smart playlists that allows me to shuffle play everything, giving higher priority to songs with more stars so I hear my favorites more often than the others.

2 Likes

I use mp3, alac and aiff files in iTunes on different systems. I don’t purchase music as I stated earlier so your information on that is important if the OP has any. But I always look for the cover art and embed all of the tracks for a given album in iTunes and that is stored separately in each music file as well as in the database. You can tell if you do a Get Info function for a music file in the Finder, you should see the cover art (although this no longer works in Catalina and probably Big Sur) if it has been embedded properly. So if you take those files on a USB drive to a car stereo that supports album art, they will display properly.

The iTunes folder in the /Users/Music folder can get large if you have a lot of files so that is another consideration if someone is running out of drive space. Mine is around 10GB for around 70,000 files.

It is probably easier for the OP to consolidate but I’ve had no issues with the process I described with multiple computers.

As I said, I don’t use star ratings but playlists export easy and import with no issues for me. When you mentioned metadata correction, I assume you’re talking about what comes from Gracenote, Apple or similar. I always check that information before I import a CD to make sure it is correct.

album art is a fraught topic of which i’ve posted before so i’ll stay away from that.

one of the things i’m trying to accomplish with this move to a larger data receptacle is the ability to share all my metadata temporarily with my laptop whilst my main computer is in transit to foreign shores. that’s the main reason i was asking if the database can be located on the external drive. i suppose i could use unix trickery and replace ~/Music/Music with a symbolic link. But would that actually work?

The symlink should work. I remember reading about people doing this with iTunes many years ago. But there should be an easier way.

Although you can’t use Music’s preferences to set the library location, you should be able to manually move it. Make sure Music is not running and then copy the Music Library.musiclibrary package to another location. Once moved, you should be able to double-click it in order to launch Music using the new library location. Music should remember the location and will use it as the new default.

Also of note, if you hold down Option when starting Music (or iTunes), you will be presented with a dialog to select a Music library or create a new library. You may find this a more convenient than double-clicking the .musiclibrary package from the Finder.

If you move the library to external storage, it should work. If the storage is not on-line when you launch Music, I think the default behavior is to create a new empty library in your home directory. If this happens, mount the storage and then either option-launch Music or double-click the library file on the external volume.

First an understanding of how the Music Library ‘file’ works may help you. This ‘file’ is actually not a file but a container. It can operate in two ways. The Apple preferred way is to check the box in Music Preferences that copies you music file into the library. While this allows you to delete the physical music files on your drive is suffers from the problem that should the library ever become corrupted you lose all your music or it is a nightmare to recover any file that was not purchased from the Music store. The other mode of operation is to simply use the Music Library as a catalog. This is done by unchecking the mentioned box above. In this mode the Music Library does not actually store your music but only a catalog of it. The separate music files on your drive are actually what is being played. If any corruption occurs with them you only risk losing the actual corrupted file. The disadvantage of this is that the music files take more physical space but they are easier to recover if the folder containing them gets corrupted. Also if you use Time Machine for backing up this music folder you can individually recover them. After being stung badly by using the Music Library in the first method I recommend the second method using it only as a catalog. Additionally there is a second check box in Music Preferences labeled ’ Keep music organized’. If this is checked and the second method is used, checking this box allows Music to organize your actual music folder containing the tracks based on the metadata that is contained in each track. Unchecking this box allows you to organize this your music folder anyway you wish, irregardless of the tracks metadata. However the catalog in the Music Library will reflect the metadata which will govern how your music appears in the Music App. For those not familiar with metadata it is data, generally invisible to the users that contains information about the track, such as name, artist, sort order, composer, genere, etc. It is partially editable by the user by using the ‘Get Info’ command in the Music App and determines how your tracks are sorted and grouped.

Now to answer your question: Your actual tracks while traditionally stored in the User Music Folder can actually be anywhere you wish them to be. That location can be indicated by the Location setting in the Files section (also containing the checkboxes mentioned above) in the Music App. I recommend first resetting it first before selecting a new location for the most trouble free performance. One not well known or documented tool to do this in the Music App is to hold down the Option key when launching the App which will allow you to choose a new or existing Music Folder (containing your music tracks) on launching the Music App. Once the location of your music tracks (Media) is selected the App will either look for an existing Music Library or create a new one in a subfolder your media folder. So moving a music library to another location is a simple as moving it to where you want it to be and then using the Option key method or the Music App preferences to tell it where it is. Just make sure you on have a single music media folder accessible for each user on your machine or strange things may happen.

Now suppose the Apple Music Library gets corrupted or you wish to start over. To do this you must either have your original music tracks in a folder accessible on your machine or a backup of your Apple Music Library if using the first method and your original music files no longer exist. If you have neither then you are likely out of luck. If you do, all that is needed is to delete the old Apple Music Library (if using the first method with all music in the library you will be deleting all of the music in it as well) the after indicating where your music media files are in the App preferences, simply choose the command ‘Add to Library’ under the Apps ‘File’ menu and that entire folder with be either added to the Apple Music Library with the original files being moved there or a catalog will be created in the Apple Music Library of your media folder depending on the preferences checkbox settings.

For advanced users you may wish to check out the free App “MusicBrainz Picard” which will allow better editing and control of a tracks metadata than Apple Music will. This will allow more customized sorting in the Music App than the Get Info in the App will.

2 Likes

I don’t think you are correct here. I’ve been working with iTunes and Music libraries for quite a long time, and nothing you wrote aligns with my experience.

You are correct that the “.musiclibrary” file is really a package - a directory containing many files, including the database indexing all your music.

Apple does not copy your music into this location. It copies them to the location specified in the Music preferences (Files → Music Media folder location). On my system, it’s using an old name (~/Music/iTunes/iTunes Music), since I have been migrating my system for many years.

Are you saying that newly created accounts get a default media location that’s within the library package? That would be pretty horrible, since you can’t even select that location when configuring Music, let alone access it easily via the Finder. And you’d have no way of purging the cruft from it if you later consolidate your media to a new location, since that copies (does not move) the files.

When Music copies music to your Music Media folder (the checkbox you mentioned), it copies it to the media location that is configured. If you also checked the “Keep Music Media folder organized” box (same page), then it organizes it pretty cleanly - Music / artist / album / track, with the track names prefixed by the track number. If the box isn’t checked, it still organizes the files according to a pattern, but it isn’t quite as clean. The original files you added to the libraries are copied to this location - nothing is lost (although the files are renamed based on the track’s metadata) and they can always be copied elsewhere if you are so inclined.

The music files consume the same amount of space whether they are copied to your media folder or not. After they are copied, Music never looks at the original again, which is why you can delete it. But there is no re-compression or any other processing done to the file.

If the music library database gets hopelessly corrupted, all your songs will be in the Media folder (if, of course, you configured Music to copy files there). You can create a new empty library and then drag/drop the Media folder onto it in order to re-create it, pulling metadata from the media files. You’ll lose your playlists and any metadata not stored in the media files, but it works fine.

If you are seeing media files disappear after adding them to the library, then maybe you have been using iTunes Match, which uses media from the Music Store to replace your files (so they can be streamed from anywhere in the world and might sound better than your original rips). I have never used this, and I don’t recommend anybody else use it, because it has been known to fail catastrophically, deleting entire music libraries in the process.

Launching Music with Option doesn’t let you select the media folder. It is looking only for a library, which is expected to contain the locations of the media files. You can either select a legacy iTunes library file (an “.itl” file) to begin a migration or select or a .musiclibrary package. I just tried it with my media folder and there is nothing in there that the app will let me select.

1 Like

I just ran a test and created a new Music library. The above did not happen.

I created a new library (~/tmp/New Music Lib). The system created a folder with this name, containing two sub-folders:

  • Media (~/tmp/New Music Lib/Media). This is an ordinary folder. Music will copy your media here if you configure it to do so. You can configure a different location for this folder via the previously mentioned preference, if you would prefer to use a different location.
  • Music Library (~/tmp/New Music Lib/Music Library.musiclibrary). This is the library database package. Media is not copied here.

Your explanation seems to complicate what the OP wanted although it is very thorough. My experience is with iTunes but I assume Music works the same and I don’t purchase any music. First, whether or not iTunes/Music copies files or not from the original locations, you should always have a backup or two somewhere. All of my music is from CD’s or digitized records/tapes so I could always go back and reimport the CD’s or digitized tracks but that would take a long time with around 35,000 tracks so it is important to back up. The location of the media folder is only really important when you are importing the CD’s (and I assume when purchasing). When you use the Add to Library command, iTunes will import the tracks regardless of what drive you have them on and that has nothing to do with the Media Folder. So I have my mp3’s on one hard drive and my AIFF files on another and all are on the same library which is stored on my startup drive’s user folder/music/iTunes location. My ALAC files are on a separate library and on another hard drive due to the 100,000 iTunes file limitation as I would be over if I kept all three formats in one library.

You state that the metadata is partially editable in Music which I think is untrue. I’ve edited all kinds of sections in iTunes and added the cover art to my liking with no issues. Maybe you’re talking about purchased music.

I’ve never had an issue with a library being corrupted so I don’t know about that either. This is going back to using iTunes 2.0.3 on OS9. I suppose it could happen but again if you back up your startup drive or wherever your iTunes/Music database resides, then you would just recopy it and restart iTunes.

I never check the Keep iTunes Media Folder organized as I found it changed things that were not to my liking but this was so long ago that I can’t recall what that was. But whatever works for you and others is fine. I just think that this discussion is getting overly complicated when this is a really simple process as I posted earlier.