Moving Keychain Secure Notes to Apple Notes
How to migrate your Keychain Secure Notes into the Notes applications.
With the removal of Secure Notes from Apple’s Keychain Access application in macOS 15, Apple appears to be suggesting Notes as the preferred destination for confidential text snippets.
Apple’s lack of support migrating from Secure Notes is an indication that this is not something they care about. Given this, I do not recommend using Notes.app to secure information. There is little to believe Apple will maintain the security of Notes to the same standard as Keychain1.
Putting that recommendation aside, below is an AppleScript that will import a folder of Keysafe exported text based Secure Notes into Apple Notes.
To use the script below:
Export your Keychain using Keysafe:
keysafe -export ~/Downloads/my-exported-keychain.tgz
Expand the exported archive;
Open the script below in macOS’s Script Editor;
Run the script and select the secure-note folder in the exported archive;
The script will create a new note for every plain text file found. The name of the note is derived from the file name.
There is no way to enable password protection on Notes with AppleScript. You must manually lock the newly created notes.
If this script saved you time and effort, please tell others and support this work.
set this_folder to (choose folder with prompt "Pick the folder containing the text files to import into Notes:") as string
tell application "System Events"
set these_files to every file of folder this_folder
end tell
repeat with i from 1 to the count of these_files
set this_file to (item i of these_files as alias)
set this_info to info for this_file
if name of this_info ends with ".txt" and visible of this_info is true and alias of this_info is false then
-- remove date and unique id prefix
set note_name to ((characters 17 thru -1 of name of this_info) as string)
-- remove .txt suffix
set note_name to ((characters 1 thru -5 of note_name) as string)
-- replace hypens with spaces
set note_name to findAndReplaceInText(note_name, "-", " ")
-- read the note
set note_contents to read this_file
-- replace newlines with html paragraphs tags as Notes expects html and not plain text
set note_contents to findAndReplaceInText(note_contents, "
", "<p>")
tell application "Notes"
make new note at folder "Notes" with properties {name:note_name, body:note_contents}
end tell
end if
end repeat
on findAndReplaceInText(theText, theSearchString, theReplacementString)
set AppleScript's text item delimiters to theSearchString
set theTextItems to every text item of theText
set AppleScript's text item delimiters to theReplacementString
set theText to theTextItems as string
set AppleScript's text item delimiters to ""
return theText
end findAndReplaceInText
Lost secure notes during a macOS update suggests Keychain is also suffering. ↩︎