Exporting voice memos with correct dates and titles on macOS Sonoma

In response to How do I "bulk" export all Voice Memos fr… - Apple Community and How do I "bulk" export all Voice Memos fr… - Apple Community, "dsfasfasdfa" had the response that worked for me. Here are the instructions for how to do this compiled into one post:


1) First, make sure you are logged in under an administrator account.


2) Second, make sure your voice memos are synced to iCloud (go to System Preferences > Apple ID > iCloud > Show More Apps... (under Apps Using iCloud) > scroll all the way down and turn on Voice Memos.


3) Third, make sure you give Terminal "Full Disk Access" (you can turn this off later). Go to System Preferences > Privacy & Security > Full Disk Access (roughly halfway down) > turn on Terminal.


4) Open Text Edit (Applications > TextEdit)


5) Copy and paste the following code into TextEdit. This is how we'll create a file that we'll simply drag and drop into Terminal later.


#!/bin/bash

# Define the base directory for the voice memo recordings
db="$HOME/Library/Group Containers/group.com.apple.VoiceMemos.shared/Recordings/"

# Create a directory for all voice memos
mkdir -p "AllVoiceMemos"
cd "AllVoiceMemos" || exit

# Save the original IFS and set a new one
OIFS="$IFS"
IFS='|'

# Query the SQLite database and process each line
sqlite3 "${db}CloudRecordings.db" "SELECT ZPATH, ZCUSTOMLABEL, ZDATE, ZENCRYPTEDTITLE FROM ZCLOUDRECORDING" | while read -r line; do
# Split the line into an array
read -ra thisline <<< "$line"

relative_location="${thisline[0]}"
name="${thisline[3]}"
date="${thisline[2]}"
offset="978307200"

# Calculate the new date
newdate=$(bc <<< "$date+$offset")
trimdate=${newdate%.*}
formatteddate=$(date -r "$trimdate" +%y%m%d%H%M.%S)

# Construct the full path to the file
full_location="${db}${relative_location}"

# Print the details (optional, for verification)
echo "Full Location: $full_location. Name: $name. Date: $date. New Date: $newdate. Trimdate: $trimdate. Formatted: $formatteddate"

# Copy the file to the new location and rename it
if [ -f "$full_location" ]; then
cp "$full_location" "./$name.m4a"
# Update the access and modification times
touch -a -m -t "$formatteddate" "./$name.m4a"
else
echo "File not found: $full_location"
fi
done

# Restore the original IFS
IFS="$OIFS"


6) In TextEdit, go up to Format > Make Plain Text. This ensures that you can rename the file with whatever extension you want.


7) Save the file and name it something, just make sure to include ".sh" at the end of it. For example, you can call it export.sh or icloudisaprisoninthesky.sh


8) Open Terminal (Applications > Utilities > Terminal)


9) Type in

chmod 755 

Make sure to include a space after 755, then drag and drop the file you just created into Terminal. Your line of code should look something like this:

chmod 755 /Users/[your username]/Desktop/export.sh

ℹ️ chmod stands for "change mode" and 755 gives you permission to run the file


10) Press enter. You should now have permission to run the file.


11) Drag and drop the file into Terminal again and press enter. The script should be running now. It might take a few minutes or longer depending on how many voice memos you have and how many are already saved locally vs. have to be downloaded.


12) Once the script is done running, your voice memos should be stored under Users > [your username] > AllVoiceMemos

Everything should be intact including the name of each voice memo and the date it was created.


Congrats! You made it out alive!


[Re-Titled by Moderator]

Posted on Feb 2, 2025 8:17 PM

Reply

There are no replies.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Exporting voice memos with correct dates and titles on macOS Sonoma

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.