Instantly share code, notes, and snippets.

Embed
What would you like to do?
Restore Messages on MacOS High Sierra. Based on the macup commad from https://github.com/balupton/dotfiles
#!/usr/bin/env bash
set -e
backupRoot="$1"
function restore {
echo "Restoring: $1"
if test -e "$backupRoot/$1"; then
sudo rm -Rf "$localRoot/$1"
mkdir -p "$(dirname "$localRoot/$1")"
cp -fav "$backupRoot/$1" "$localRoot/$1"
sudo chmod -R -N "$localRoot/$1"
sudo chown -R "$USER" "$localRoot/$1"
else
warning="MISSING: $backupRoot/$1"
warnings="$warnings\n$warning"
echo "$warning"
fi
}
function remove {
echo "Removing: $1"
sudo rm -Rf "$localRoot/$1"
}
remove "Library/Caches/com.apple.iChat"
restore "Library/Preferences/com.apple.sms.plist"
restore "Library/Preferences/com.apple.messaging.expire.plist"
restore "Library/Preferences/com.apple.Messages.plist"
restore "Library/Preferences/com.apple.imessage.plist"
restore "Library/Preferences/com.apple.imessage.bag.plist"
restore "Library/Preferences/com.apple.imdpersistence.IMDPersistenceAgent.plist"
restore "Library/Preferences/com.apple.imdsmsrecordstore.plist"
restore "Library/Preferences/com.apple.imservice.ids.FaceTime.plist"
restore "Library/Preferences/com.apple.imservice.ids.iMessage.plist"
restore "Library/Preferences/com.apple.iChat.AIM.plist"
restore "Library/Preferences/com.apple.iChat.Jabber.plist"
restore "Library/Preferences/com.apple.iChat.StatusMessages.plist"
restore "Library/Preferences/com.apple.iChat.Yahoo.plist"
restore "Library/Preferences/com.apple.iChat.plist"
restore "Library/Messages"
restore "Library/Containers/com.apple.iChat"
restore "Library/Containers/com.apple.messages.MapRenderingService"
restore "Library/Containers/com.apple.messages.ShareExtension"
restore "Library/Containers/com.apple.messages.StorageManagementExtension"
restore "Library/Containers/com.apple.messages.TranscriptRenderingService"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment