How to delete GameCenter and iCloud from Internet Accounts using the Terminal?

Solution 1:

The Internet accounts are stored in ~/Library/Accounts/Accounts4.sqlite.

  • give your terminal full disk access or you can't access ~/Library/Accounts
  • create a backup (e.g. cp ~/Library/Accounts ~/Library/Accounts.bak
  • open it with sqlite3 or any other sqlite client such as DB Browser for SQLite
  • give full disk access to your sqlite client (important if using a client with a GUI or its own wrapper, such as the above)
  • SELECT * from ZACCOUNT;
  • delete the row you want gone
  • save
  • reopen Internet Settings

This helped me get rid of a broken Game Center account on Big Sur. The account caused the Internet Accounts dialog to freeze.

credits: https://www.telnetport25.com/2020/04/macos-catalina-there-was-an-error-in-internet-accounts-preferences/