The operation couldn’t be completed. (OSStatus error -54.)

Xcodeをダウンロードして1日後から以下のエラーが出るようになりました。

ダウンロードした当日は問題なくビルドできてデバッグ確認できていたのですがなぜか次の日から何をやってもこれが治らなくなりました…

Details

The operation couldn’t be completed. (OSStatus error -54.)
Domain: NSOSStatusErrorDomain
Code: -54
User Info: {
    NSDebugDescription = installForLaunchServices;
    "_LSFunction" = "-[_LSInstaller installApplication:atURL:withOptions:installType:reply:]";
    "_LSLine" = 687;
}
--
If you think this is a bug, please report it at feedbackassistant.apple.com
Include the details above.


System Information

macOS Version 10.15.7 (Build 19H2)
Xcode 12.1 (17222)

解決策

結論から言うとXcodeをダウンロードし直しました。

再起動すれば治るみたいな記事もあったのですが何度再起動してもXcodeのキャッシュを消しても治らなかったのでやむなくダウンロードし直しました..
変なキャッシュが残るといやなので以下のコマンドでバグっている既存Xcodeを削除してから入れ直しました。

sudo rm -rf /Applications/Xcode.app
sudo rm -rf /Library/Preferences/com.apple.dt.Xcode.plist
sudo rm -rf ~/Library/Preferences/com.apple.dt.Xcode.plist
sudo rm -rf ~/Library/Caches/com.apple.dt.Xcode
sudo rm -rf ~/Library/Application Support/Xcode
sudo rm -rf ~/Library/Developer/Xcode
sudo rm -rf ~/Library/Developer/CoreSimulator