Hey there!<p>I just released the first version of a project I’ve been working on solves a very specific problem that perhaps only I have. I welcome any and all feedback, even if you just want to drop in to say that this is a hot piece of garbage!
I am excited to see more solutions that work with Apple Notes database directly. This is my go-to application to capture unstructured memos while researching various topics. Last year I got carried away and built a simple site generator for Notes [0]. As a fun exercise I implemented ORM models to query Sqlite database in Ruby:<p><pre><code> User::Account.server(database: "tmp/test.sqlite").first.
folders_dataset.offset(1).first
notes.
map(&:attachments).flatten.
find { |el| el.is_a?(User::ObjectTypes::EmbeddedPublicJpeg) &&
el.height > 700 &&
el.summary[/animal/i] }.
media_filepath
=> "Accounts/<uuid>/Media/F669B83A-0C47-408E-9645-015737F3B11F/Pasted Graphic.jpg"
</code></pre>
Apple Notes' database structure is a fascinating product story. Notes started as a simple note-taking application that stored its content as raw HTML in a few simple tables. However, as the product grew and needed more features like collaboration, they had to make changes and add new columns and tables. They also implemented two flavors of CRDT-like algorithms that evolved over time: one for plaintext chunks and the other one for embedded objects like tables. On top of that, every change that Apple makes must be backward compatible to support legacy devices and systems; but backward-compatibility was not always possible and users had to go through “Migrate your Notes” steps, but it is again a product story.<p>I wish that one day, someone from the development team would write an article about it.<p>[0] <a href="https://devlog.notespub.com/2022/08/site-generator-for-apple-notes/" rel="nofollow">https://devlog.notespub.com/2022/08/site-generator-for-apple...</a>
I wrote a similar tool in Python a few weeks ago, which uses AppleScript to liberate the data and saves it to a SQLite database: <a href="https://datasette.io/tools/apple-notes-to-sqlite" rel="nofollow">https://datasette.io/tools/apple-notes-to-sqlite</a><p>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! <a href="https://til.simonwillison.net/gpt3/chatgpt-applescript" rel="nofollow">https://til.simonwillison.net/gpt3/chatgpt-applescript</a><p>Apple Notes Liberator creates a copy of the SQLite database and then runs queries against that directly to extract the data.<p>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.
A feature that a lot of Apple apps have that doesn't seem talked about much is they can use standard protocols and not require iCloud.<p>Mail.app/Reminders.app/Notes.app can use IMAP, Cal.app with CalDAV, and Contacts.app with CardDAV [1].<p>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.<p>I've done this with my iPhone/Macs and Fastmail for the last few years and it works great [2].<p>1. <a href="https://support.apple.com/guide/iphone/set-up-mail-contacts-and-calendar-accounts-ipha0d932e96/ios" rel="nofollow">https://support.apple.com/guide/iphone/set-up-mail-contacts-...</a><p>2. <a href="https://www.fastmail.help/hc/en-us/articles/1500000279941" rel="nofollow">https://www.fastmail.help/hc/en-us/articles/1500000279941</a>
Super interesting, particularly the link through to the blog with all the research into how Notes works.<p>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.<p>It looks like the info on the page may be a good place to start looking to how that works: <a href="https://www.ciofecaforensics.com/2020/10/20/apple-notes-cloudkit-data/" rel="nofollow">https://www.ciofecaforensics.com/2020/10/20/apple-notes-clou...</a>
I have published an app [Exporter](<a href="https://apps.apple.com/us/app/exporter/id1099120373?mt=12" rel="nofollow">https://apps.apple.com/us/app/exporter/id1099120373?mt=12</a>) that does something similar - exports Apple Notes to HTML and markdown with the attachments. Give it a try, let me know if it solves your issue.<p>Also, why did you select JSON as the output format?
Cool! Thanks for sharing. Also worth noting that there's a Mac app in the app store to export to markdown or html:<p><a href="https://apps.apple.com/us/app/exporter/id1099120373?mt=12" rel="nofollow">https://apps.apple.com/us/app/exporter/id1099120373?mt=12</a><p>(I haven't had a need yet, so I haven't tried it)
If anyone ever wanted to do something similar for iMessage data, I built a similar tool for that: <a href="https://github.com/ReagentX/imessage-exporter">https://github.com/ReagentX/imessage-exporter</a>
I consistently struggle with Notes and iMessage sync issues, and I suspect it’s due to being a customer for so many years and making my way through many devices over those years.<p>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.<p>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.
This is great! How do you account for updates to a note?<p>I’ve been building an archiver tool as well to convert notes into markdown and post to git using Apple Shortcuts.<p>The interop between almost all iOS data formats (notes, safari, calendar, etc.) the content graph[0] provides is really impressive.<p>[0]: <a href="https://support.apple.com/en-me/guide/shortcuts/apd4618db957/ios" rel="nofollow">https://support.apple.com/en-me/guide/shortcuts/apd4618db957...</a>
Here's a Python script that takes the JSON output from <a href="https://github.com/threeplanetssoftware/apple_cloud_notes_parser">https://github.com/threeplanetssoftware/apple_cloud_notes_pa...</a> (needs master), and rebuilds Notes in Markdown format (or HTML), with links, attachments, lists, etc.:<p><a href="https://gist.github.com/vszakats/5a3bd939721d1dde6142d9ea3b2d1b5f" rel="nofollow">https://gist.github.com/vszakats/5a3bd939721d1dde6142d9ea3b2...</a><p>And a short, standalone JXA script, that outputs HTML, but loses some data, such as links:
<a href="https://gist.github.com/vszakats/f24e7700428c1e694e20cee0b1cc542b" rel="nofollow">https://gist.github.com/vszakats/f24e7700428c1e694e20cee0b1c...</a>
Love this. I am an Apple Notes absolutist (see: <a href="https://pbs.twimg.com/media/FY1rZvNWIAAIRzs.jpg" rel="nofollow">https://pbs.twimg.com/media/FY1rZvNWIAAIRzs.jpg</a>). I have tried Evernote, Workflowy, Dynalist, Notion over the years for marrying personal / professional worlds but always (always!!) come back to Notes.<p>I have dreamed of the ability to have a Notes web app with custom CSS for years and a few other features.<p>Good luck with this project I'll be watching closely
I don't understand what value this tool adds over the library it uses under the hood (which includes a command line tool for exporting your notes; I've been using it for years). What is it for?
Note that Notes.app can also sync with IMAP.<p>IMAP syncing supports basic formatting (bold, italic, underline) but not all features supported by iCloud syncing (attachments, checklists, photos).
Oh neat. I’ve been using Notes extensively since the beginning of this year. Daily journaling. Personal TODO lists, grocery list (shared w my wife), and gym/workout tracking.<p>It works <i>really well</i> 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.
As a windows user, while we don't have an OS built-in equivalent, the standard for such tools (in the form of Sublime and the like) is just to operate with temporary buffers that get written out as files on user request. Sublime will write internal data to some persistent storage somewhere and be able to survive sudden crashes and restarts but when you'd like to save the data out to a fixed filepath it's pretty trivial to do so. I do find it quite weird that Apple has managed to cultivate a system where storage in separate files isn't taken as the default.
I am excited to see more ways to export data out of Apple Notes. Long term it would be amazing to see a solution that allows more interoperability with other apps.<p>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.<p>From the Obsidian forum:
<a href="https://forum.obsidian.md/t/import-from-apple-notes-to-obsidian/732" rel="nofollow">https://forum.obsidian.md/t/import-from-apple-notes-to-obsid...</a>
I have been adopting Apple Notes more after trying to use a lot of other note methods/apps. Always fall back to simple text in Notes. And I seem to be hearing of more people doing the same.<p>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."
This is cool. I wanted to provide notes export for people using a note taking service I built and landed on a ios shortcut.<p>I think you can accomplish something close or the same? using shortcuts.<p>One obvious benefit is the interface is going to be more approachable than the jar to most people.<p>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.
Very nice reverse engineering work! I wrote a python library and CLI that does something similar but interacts with Notes via Scripting Bridge: <a href="https://github.com/RhetTbull/macnotesapp">https://github.com/RhetTbull/macnotesapp</a>
I built something similar a while back.<p>But instead of pulling the data out of Notes, I took it from SMTP mail.<p>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.
instead of extracting notes data as JSON my simple tool allows you to liberate your notes by publishing them to the web.<p><a href="https://montaigne.io/" rel="nofollow">https://montaigne.io/</a><p>I use the same amazing library linked in the blog post.
Awesome initiative!
I wish Apple Notes would support Markdown.
This is my go to app for so much of my life, à Notion style editor would be an absolute game changer.