How To Always Sync Your Purchased Music Between Devices Into Apple Music

If you’ve purchased music outside of Apple Music (for example, you’re a DJ and bought your music from Beatport, or maybe you’re supporting your favorite indie artist on Bandcamp) and want it to sync across all your devices, you might have noticed that Apple Music doesn’t always reliably upload your files to iCloud. Here’s the reliable method I’ve found that actually works.

The Problem

Simply dragging music files into Apple Music often results in them sitting locally on one device without ever syncing to the cloud. The app needs a specific nudge to recognize new files and begin the upload process.

The Solution

Follow these steps exactly, and your music will upload every time.

Step 1: Convert to AIFF

Before importing, convert your music files to AIFF format. While Apple Music supports various formats, AIFF consistently works best for cloud uploads. I don’t know why this is, I just know that anecdotally, this is where I’ve had the best luck.

If you have ffmpeg installed, you can convert files with this command (which will preserve any metadata and album art):

ffmpeg -i input.mp3 -write_id3v2 1 output.aiff

For batch conversion of multiple files in a folder:

for file in *.mp3; do ffmpeg -i "$file" -write_id3v2 1 "${file%.mp3}.aiff"; done

Step 2: Create a Fresh Temporary Playlist

Open Apple Music and create a brand new, completely empty playlist. This step is crucial and must be repeated each time you want to import new music. Don’t reuse an old playlist.

Step 3: Drag and Wait

Drag your AIFF files from Finder directly into your new temporary playlist. Once the files appear in the playlist, wait about 10 seconds. Don’t rush to the next step.

Step 4: Close and Reopen (The Critical Step)

Here’s the trick that makes everything work: completely quit Apple Music and reopen it. For whatever reason, Apple Music won’t analyze and upload your files until the app has been restarted. This seems to be what triggers the cloud sync process.

Step 5: Monitor the Upload

After reopening Apple Music, give it about a minute to begin processing. You can check the upload status in two places:

  • Bottom left corner: Look for upload progress indicators
  • Songs view: Open the Songs panel to see individual tracks as they’re being uploaded

Once the uploads complete, your music will be available across all your devices through iCloud Music Library.

Step 6: Move to Your Real Playlists

Now that your tracks have been uploaded to the cloud, you can add them to any of your regular cloud-enabled playlists. The temporary playlist served its purpose, and you’re free to organize your newly imported music however you like. These tracks will now sync properly across all your devices.

Why This Works

Apple Music’s cloud sync mechanism apparently doesn’t continuously scan for new files. The app restart forces it to re-index your library and discover the newly added tracks, triggering the upload process. Using the temporary playlist seems to tell Apple that these are external files that you would like to sync up to the cloud.

This workaround has proven reliable when the standard drag-and-drop method fails, ensuring your purchased music from other sources integrates seamlessly with your Apple Music library.

How to fix slow loading when trying to take a screenshot with CMD+SHIFT+4

I don’t know how common this is, but I wanted to share a tip that I recently learned about how to fix slow loading when trying to take a screenshot with the CMD+SHIFT+4 shortcut. It used to pop up the selector instantly, but recently I noticed it was taking multiple seconds to load up. Nothing earth shattering, but annoying and taking me out of my flow state. Here’s how I fixed it.

Load up the full screenshot panel using CMD+SHIFT+5 (note the 5, rather than 4) and see what your microphone is set to. If it’s set to anything other than None, set it _to_ None and then hit the Esc key a few times to exit out of there. Now try doing your CMD+SHIFT+4 again and it should pop up nearly instantly.

Before: A Revelator Dynamic microphone is selected
After: No microphone is selected

My assumption on why this works is that if you have a microphone configured, it probably needs to physically interface with the device and initializing hardware can sometimes take a few seconds. Having a microphone might be useful if you’re doing a screen recording using CMD+SHIFT+5 but the ...+4 option doesn’t do any video, so microphones are really not necessary here. It would be great if Apple bypassed this check already since it’s completely useless, but as it stands today, this should get your screenshot taking back instantly.

How to debug Terraform variable content using this custom module

A lot of the time when I’m having to debug Terraform, I find that I want to quickly look at what Terraform may be storing inside a variable so that I can understand where I’ve made a mistake passing data around. After literal years of using the old TF_LOG=debug method – which can get way too unwieldy with any decently sized environment, I realized I could write a simple module to dump out what I was looking for. Hopefully this will help you too.

resource "null_resource" "terraform-debug" {
  provisioner "local-exec" {
    command = "echo $VARIABLE1 >> debug.txt ; echo $VARIABLE2 >> debug.txt"

    environment = {
        VARIABLE1 = jsonencode(var.your_variable_name)
        VARIABLE2 = jsonencode(local.piece_of_data)
    }
  }
}

Just replace var.your_variable_name_goes_here with your actual variable reference and then run your terraform apply. A file should be spit out in the same directory that the .tf file that you inserted this resource lives in, which you can then open up and understand what might be going on.

I don’t know why it took me so long to figure out something so simple, but coming from PHP/Laravel – where you can just dd() or dump() the contents of a variable to the console – the idea of using the local-exec provisioner to debug terraform just never occurred to me.

EDIT [Jan 6, 2020]: Wrapped variable data in jsonencode() to avoid issues with echoing an empty string to a file. Also show how to dump multiple variables to the same file.