我购买第二本Macbook时遇到了这个问题。我认为使用iCloud同步两者很简单。不幸的是,正如许多人所报告的那样,这是一个非常不可靠的过程。我决定编写一个bash shell脚本来处理它。它完美地工作。您可以双击在Finder中看到的备份/还原文件。我备份到Dropbox,但是您可以修改脚本以将其写入/读取到其他地方。我不知道如何在这里上传脚本,因此将它们作为文本包含在下面。脚本中有很多注释,因此您应该能够确定该过程。主脚本将备份整个Notes应用程序目录。它还将创建合适的还原脚本,以将备份还原到任何其他Mac。
#!/bin/bash
#set -x
DT=`date "+%y%b%d"`
SAV_DIR=~/Dropbox/Notes
NOTE_DIR=~/Library/Group*/group.com.apple.notes*
TARFILE=Notes.$DT
RESTORE_FILE=notes_restore.$TARFILE.$HOSTNAME.sh
#echo DT=$DT
#echo SAV_DIR=$SAV_DIR
#echo TARFILE=$TARFILE
#echo RESTORE_FILE=$RESTORE_FILE
#ls -ld $NOTE_DIR
# Preserve ownership, permissions and full path to ensure files are
# restored to original locations
# ** You need to use tar xPpf to preserve full path and permissions on
# ** the restore command as well else the leading / will be removed and
# ** the files will be restored relative to where you run the command
tar cfpP /tmp/$TARFILE.$HOSTNAME.tar $NOTE_DIR
mv /tmp/$TARFILE.$HOSTNAME.tar $SAV_DIR
# ------------ Create Restore Script ----------------
# The restore script will have the same name, date and hostname
# as the notes tar file saved in the Dropbox folder
# The file can be seen in the Finder Dropbox window. A double click
# on it will run the restore script.
# This ensures that you can export the Notes app files to dropbox
# from any host and restore to any host by selecting the appropriate
# tar file restore script
echo "#! /bin/bash " > /tmp/$RESTORE_FILE
echo "cp $SAV_DIR/$TARFILE.$HOSTNAME.tar /tmp" >> /tmp/$RESTORE_FILE
echo "tar xPpf /tmp/$TARFILE.$HOSTNAME.tar" >> /tmp/$RESTORE_FILE
echo "/bin/rm /tmp/$TARFILE.$HOSTNAME.tar" >> /tmp/$RESTORE_FILE
chmod 755 /tmp/$RESTORE_FILE
mv /tmp/$RESTORE_FILE $SAV_DIR