I didn't actually know AppleScript before writing this tool... but it turned out ChatGPT knew it well enough to unblock me and provide me with exactly the code I needed to build the rest of the project! https://til.simonwillison.net/gpt3/chatgpt-applescript
Apple Notes Liberator creates a copy of the SQLite database and then runs queries against that directly to extract the data.
I chose not to do that (despite being all-in on SQLite for everything) because I worry about future changes to the software baking my script - I figured the AppleScript interface was less likely to have breaking changes in the future.
Mail.app/Reminders.app/Notes.app can use IMAP, Cal.app with CalDAV, and Contacts.app with CardDAV [1].
It doesn't offer a lot of the features iCloud has like advanced formatting or collaboration, but is a useful for simple standards based syncing and portability.
I've done this with my iPhone/Macs and Fastmail for the last few years and it works great [2].
1. https://support.apple.com/guide/iphone/set-up-mail-contacts-...
2. https://www.fastmail.help/hc/en-us/articles/1500000279941
A particularly interesting thing that I don't see mentioned anywhere is that Apple Notes uses CRDTs (conflict free replicated data types) to enable both shared notes and multiple concurrent edits. With the CRDTs resolving the conflicts.
It looks like the info on the page may be a good place to start looking to how that works: https://www.ciofecaforensics.com/2020/10/20/apple-notes-clou...
Also, why did you select JSON as the output format?
https://apps.apple.com/us/app/exporter/id1099120373?mt=12
(I haven't had a need yet, so I haven't tried it)
The UX of the Apple ecosystem is so nice but when it goes sideways you’re kind of out of luck, even if you have applecare.
I wish they had some sort of premium “fix my esoteric appleID account issues” service you could pay them for once a decade or so.
I’ve been building an archiver tool as well to convert notes into markdown and post to git using Apple Shortcuts.
The interop between almost all iOS data formats (notes, safari, calendar, etc.) the content graph[0] provides is really impressive.
[0]: https://support.apple.com/en-me/guide/shortcuts/apd4618db957...
https://gist.github.com/vszakats/5a3bd939721d1dde6142d9ea3b2...
And a short, standalone JXA script, that outputs HTML, but loses some data, such as links: https://gist.github.com/vszakats/f24e7700428c1e694e20cee0b1c...
I have dreamed of the ability to have a Notes web app with custom CSS for years and a few other features.
Good luck with this project I'll be watching closely
IMAP syncing supports basic formatting (bold, italic, underline) but not all features supported by iCloud syncing (attachments, checklists, photos).
It works really well and has way more features than people realize. If you’re looking for like a “Notion-lite”, the answer might already be on your phone/MacBook.
What’s next?
Depending on what you are looking to achieve there are a few ways to export Apple Notes to Markdown files, but it's only a one-way out solution.
From the Obsidian forum: https://forum.obsidian.md/t/import-from-apple-notes-to-obsid...
I recently set up a shortcut that works on both my Mac and iPhone to create a new note each day with the date as the title. And then each time I trigger the shortcut that day, it enters the time, location and weather. Easy way to keep a running "diary."
I think you can accomplish something close or the same? using shortcuts.
One obvious benefit is the interface is going to be more approachable than the jar to most people.
Shortcuts are also cool because you can build one and package it for others and even define user specific parameters that get filled on install.
But instead of pulling the data out of Notes, I took it from SMTP mail.
I don't know if it still works this way, but when I did it, if you used a non-iCloud email address to sync Notes, it saved the data as pain text in email messages that could be easily parsed.
I use the same amazing library linked in the blog post.
Where is it located usually? Or what's the file name?
I wish that one day, someone from the development team would write an article about it.
[0] https://devlog.notespub.com/2022/08/site-generator-for-apple...