How to save your Notes from your iPhone



The aim of this little tutorial is to extract all Notes from iPhone without one of the many tools offered in the internet.
This tutorial includes Perl, a little SQLite-Database-Knowledge and some HTML stuff too.

First you need to make a backup from your iPhone. It's obvious.

Where is the Notes Database located?

To make it short:

~/Library/Application Support/MobileSync/Backup/[UDID]/ca3bc056d4da0bbf88b5fb3be254f3b7147e639c

UDID means your individual ""Unique Device Identifier"". If you have a backup of your iPad too, this UDID would have an other number.
How I found it? (to make it long): In your Mobile-Phone Backup are many cryptic folders. You certainly know already. Go into the Shell and enter these commands:
the UDID is your User id. You only have to write the first letters and then <tab> to complete the rest. Of course you may do the same, with all other folders before: ~/Li <tab> Appl <tab> ...

Commands in tcsh (Shell - Terminal)
1.
2.
cd ~/Library/Application Support/MobileSync/Backup/[UDID]
ls -1 | less

Comment to the 2. command: ls means list the file or folder names from where you are, the switch -1 means one line per entry. | means a pipe to another command. less means a program showing text and look through. You need following commands to scroll to the bottom: <space> one page down <b> one page up (like "back") <q> quit (terminate) the program.
The result is impressing: all these cryptic filenames. And which one are sqlite databases? It is not obvious to find them. First you could find all files which are bigger than ...

Commands in tcsh (Shell - Terminal)
1.open -a sqlitebrowser ~/Library/Application\ Support/MobileSync/Backup/[UDID]/ca3bc056d4da0bbf88b5fb3be254f3b7147e639c
Command in sqlitebrowser
1.sqlitebrowser: SELECT * FROM ZNOTEBODY

Now you select the Note you want to import. Each note is starting with the Title - first Words of first line are the Titles of each note. All this you paste into a template:

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<h1>Your Title comes here!</h1>
--> Insert your Notes here <--
</body>
</html>

Save this template somewhere for example as notes.html and open it with your browser.