sh 在macOS上卸载Mail
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 在macOS上卸载Mail相关的知识,希望对你有一定的参考价值。
#!/bin/bash
# Uninstall Script
if pgrep -x "Mail" > /dev/null; then
echo 'Mail is running, quit Mail first!';
exit 2
fi
if pgrep -x "Contacts" > /dev/null; then
echo 'Contacts is running, quit Contacts first!';
exit 2
fi
if pgrep -x "Calendar" > /dev/null; then
echo 'Calendar is running, quit Calendar first!';
exit 2
fi
if pgrep -x "Messages" > /dev/null; then
echo 'Messages is running, quit Messages first!';
exit 2
fi
if pgrep -x "Notes" > /dev/null; then
echo 'Notes is running, quit Notes first!';
exit 2
fi
if [ "${USER}" != "root" ]; then
echo "$0 must be run as root!"
exit 2
fi
read -p "Remember to remove accounts first in Internet Accounts! Press enter to continue"
echo "Removing GPG..."
rm -rf /Library/LaunchAgents/org.gpgtools.*
rm -rf /Library/LaunchDaemons/org.gpgtools.*
rm -rf /Library/Mail/Bundles.gpgmail_upgrade_*
rm -rf /Library/Mail/Bundles/GPGMail.mailbundle
rm -rf /Library/PreferencePanes/GPGPreferences.prefPane
rm -rf /private/var/db/receipts/org.gpgtools.*
rm -rf /usr/local/MacGPG2
rm -rf /usr/local/MacGPG2/bin/gpgparsemail
rm -rf ~/Library/Application\ Support/GPGTools
rm -rf ~/Library/Caches/org.gpgtools.gpgmail.updater
rm -rf ~/Library/Caches/org.gpgtools.macgpg2.updater
rm -rf ~/Library/Caches/org.gpgtools.updater
rm -rf ~/Library/Logs/gpgmail-uuid-patcher.log
rm -rf ~/Library/Preferences/org.gpgtools.gpgmail.plist
echo "Removing Internet Accounts Preferences..."
rm -rf ~/Library/Accounts
rm -rf ~/Library/Calendars
rm -rf ~/Library/Mail
rm -rf ~/Library/Messages
rm -rf ~/Library/Application\ Scripts/com.apple.mail
rm -rf ~/Library/Containers/com.apple.AddressBook
rm -rf ~/Library/Containers/com.apple.AddressBook.ContactsAccountsService
rm -rf ~/Library/Containers/com.apple.AddressBook.FaceTimeService
rm -rf ~/Library/Containers/com.apple.AddressBook.InternetAccountsBridge
rm -rf ~/Library/Containers/com.apple.CalendarAgent
rm -rf ~/Library/Containers/com.apple.CalendarAgent.CalNCService
rm -rf ~/Library/Containers/com.apple.CalendarFileHandler
rm -rf ~/Library/Containers/com.apple.ContactsUI.ContactPickerService
rm -rf ~/Library/Containers/com.apple.iCal
rm -rf ~/Library/Containers/com.apple.iCal.CalendarNC
rm -rf ~/Library/Containers/com.apple.iChat
rm -rf ~/Library/Containers/com.apple.mail
rm -rf ~/Library/Containers/com.apple.MailServiceAgent
rm -rf ~/Library/Containers/com.apple.Notes
rm -rf ~/Library/Containers/com.apple.share.Mail.compose
rm -rf ~/Library/Preferences/ByHost/com.apple.iChat.*
rm -rf ~/Library/Preferences/ByHost/com.apple.syncservices.*
rm -rf ~/Library/Preferences/com.apple.accounts.plist
rm -rf ~/Library/Preferences/com.apple.accountsd.plist
rm -rf ~/Library/Preferences/com.apple.AddressBook.plist
rm -rf ~/Library/Preferences/com.apple.iCal.plist
rm -rf ~/Library/Preferences/com.apple.iChat.*
rm -rf ~/Library/Preferences/com.apple.iChat.StatusMessages.plist
rm -rf ~/Library/Preferences/com.apple.mail-shared.plist
rm -rf ~/Library/Saved\ Application\ State/com.apple.iCal.savedState
rm -rf ~/Library/Saved\ Application\ State/com.apple.iChat.savedState
rm -rf ~/Library/Saved\ Application\ State/com.apple.mail.savedState
rm -rf ~/Library/Saved\ Application\ State/com.apple.Notes.savedState
rm -rf ~/Library/Application\ Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/com.apple.addressbook.sfl
rm -rf ~/Library/Application\ Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/com.apple.ical.sfl
rm -rf ~/Library/Application\ Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/com.apple.ichat.sfl
rm -rf ~/Library/Application\ Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/com.apple.mail.sfl
rm -rf ~/Library/Application\ Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/com.apple.preferences.internetaccounts.sfl
rm -rf ~/Library/Caches/com.apple.accountsd
rm -rf ~/Library/Caches/com.apple.AddressBookSourceSync
rm -rf ~/Library/Caches/com.apple.iChat
rm -rf ~/Library/Caches/com.apple.Messages
killall SyncServer
rm -rf ~/Library/Application\ Support/SyncServices
rm -rf ~/Library/Logs/Sync/syncservices.log
rm -rf ~/Library/Application\ Support/CrashReporter/accountsd*
rm -rf ~/Library/Logs/accountsd
rm -rf ~/Library/Logs/com.apple.accountsd
rm -rf ~/Library/Logs/DiagnosticReports/accountsd*
security delete-generic-password -l com.apple.account.Google.oauth-token
security delete-generic-password -l com.apple.account.Google.oath-refresh-token
security delete-generic-password -l com.apple.account.Google.oauth-expiry-date
read -p "Remember to remove com.apple.account.Google.accountsync in Keychain Access! Press enter to continue"
echo "All Done! Please REBOOT! REBOOT! Add Google Account to Internet Accounts, check all, Open Mail, Go to Mailbox menu item, choose Synchronize Google, wait for it to sync"
##also check (drafts issue)
## https://www.twistermc.com/42876/cleanup-drafts-mail-gmail/
## https://productforums.google.com/forum/#!topic/gmail/tUzX6761JDI
## https://www.reddit.com/r/osx/comments/5pb12k/gmail_generates_multiple_drafts_when_using_stock/
## https://apple.stackexchange.com/questions/278262/apple-mail-producing-multiple-duplicate-drafts-on-gmail
## https://discussions.apple.com/thread/7696055?start=0&tstart=0
以上是关于sh 在macOS上卸载Mail的主要内容,如果未能解决你的问题,请参考以下文章
如何在 MacOS 上明确卸载 python 2.7 [重复]
如何在macos上完全卸载flutter并以正确的方式重新安装?
sh [在macos上运行NiFi]在OSX上运行NiFi #nifi #macos