将所有 Xcode 设置恢复到原始状态

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21141112/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:02:46  来源:igfitidea点击:

Reverting all Xcode settings to their original state

xcodexcode5

提问by dasblinkenlight

I got my Xcode into a non-functional state when I can no longer start a search: once I press ?+F, Xcode hangs with a spinning pinwheel, and stops responding. Once this happens, my only option is to force quit and restart.

当我无法再开始搜索时,我的 Xcode 进入了非功能状态:一旦我按下?+F,Xcode 就会挂起一个旋转的风车,并停止响应。一旦发生这种情况,我唯一的选择就是强制退出并重新启动。

I tried looking for the saved settings in the workspace and project directories, but the recent search options that I am looking to delete appear to be stored elsewhere. I know that I could clear recent searches through the UI, but that would require bringing up the search dialog, which hangs Xcode.

我尝试在工作区和项目目录中查找保存的设置,但我要删除的最近搜索选项似乎存储在其他地方。我知道我可以通过 UI 清除最近的搜索,但这需要打开搜索对话框,该对话框会挂起 Xcode。

I would like to reset Xcode to its original state. How do I do it without reinstalling Xcode?

我想将 Xcode 重置为其原始状态。如何在不重新安装 Xcode 的情况下执行此操作?

回答by Nils Hott

This is the officially recommended way to delta Xcode 5's preferences, type in Terminal.app:

这是官方推荐的增量 Xcode 5 首选项的方法,输入 Terminal.app:

defaults delete com.apple.dt.Xcode

That should restore Xcode to the state of its first launch.

这应该会将 Xcode 恢复到首次启动时的状态。

(for older versions of Xcode the command was defaults delete com.apple.Xcode, i.e. without the dtin the middle).

(对于旧版本的 Xcode,命令是defaults delete com.apple.Xcode,即dt中间没有 )。

回答by Aqib Mumtaz

Reset all XCode settings from command line by running following commands then restart XCode:

通过运行以下命令从命令行重置所有 XCode 设置,然后重新启动 XCode:

defaults delete com.apple.dt.Xcode
rm -rf $HOME/Library/Application Support/Developer/Shared/Xcode
rm -rf $HOME/Library/Saved\ Application\ State/com.apple.dt.Xcode.savedState
rm -rf $HOME/Library/Preferences/com.apple.dt.Xcode.*