Useful macOS defaults: Xcode
com.apple.dt.Xcode controls how Xcode looks and behaves. Xcode has a large number of hidden settings that are not in the Settings window.
After changing these, quit and reopen Xcode.
Show build times in the toolbar
Display how long each build takes in the activity bar at the top of the Xcode window:
defaults write com.apple.dt.Xcode ShowBuildOperationDuration -bool trueThis is one of the most popular Xcode defaults. You see the build time right after each build finishes.
Show line numbers
Show line numbers in the gutter:
defaults write com.apple.dt.Xcode DVTTextShowLineNumbers -bool trueYou can also turn this on in Xcode, then Settings, then Text Editing, then Display.
Show code folding ribbon
Show the folding ribbon in the gutter (the grey strip that lets you collapse blocks of code):
defaults write com.apple.dt.Xcode DVTTextShowFoldingSidebar -bool trueShow invisible characters
Show spaces, tabs, and line endings:
defaults write com.apple.dt.Xcode DVTTextShowInvisibleCharacters -bool trueTrim trailing whitespace
Remove whitespace at the end of lines when saving:
defaults write com.apple.dt.Xcode DVTTextEditorTrimTrailingWhitespace -bool trueAlso trim whitespace on lines you did not edit:
defaults write com.apple.dt.Xcode DVTTextEditorTrimWhitespaceOnlyLines -bool trueIndentation
Use spaces instead of tabs:
defaults write com.apple.dt.Xcode DVTTextIndentUsingTabs -bool falseSet the indent width (number of spaces):
defaults write com.apple.dt.Xcode DVTTextIndentWidth -int 4Set the tab width:
defaults write com.apple.dt.Xcode DVTTextTabWidth -int 4Page guide
Show a vertical line at a specific column (useful for keeping lines short):
defaults write com.apple.dt.Xcode DVTTextPageGuideLocation -int 80
defaults write com.apple.dt.Xcode DVTTextShowPageGuide -bool trueMinimap
Show the code minimap on the right side of the editor:
defaults write com.apple.dt.Xcode DVTTextShowMinimap -bool trueMaximum number of concurrent compile tasks
Set how many files Xcode compiles at the same time. By default, Xcode uses the number of CPU cores:
defaults write com.apple.dt.Xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks 8Set this to a lower number if builds make your Mac unresponsive, or higher if you have cores to spare.
Disable source control
Turn off the built-in Git integration:
defaults write com.apple.dt.Xcode IDESourceControlEnableSourceControl -bool falseSome developers prefer to use Git from the command line or a dedicated Git app.
Show all build settings
Show the raw build settings in the build settings editor (including the setting names, not just the display names):
defaults write com.apple.dt.Xcode IDEBuildSettingsShowRawValues -bool trueEnable internal debug menu
defaults write com.apple.dt.Xcode ShowDVTDebugMenu -bool trueThis adds a Debug menu with tools for inspecting Xcode itself.
Derived data location
Read where Xcode stores its build artefacts:
defaults read com.apple.dt.Xcode IDECustomDerivedDataLocationYou can set a custom location:
defaults write com.apple.dt.Xcode IDECustomDerivedDataLocation -string "/path/to/DerivedData"Or clear it to go back to the default (~/Library/Developer/Xcode/DerivedData):
defaults delete com.apple.dt.Xcode IDECustomDerivedDataLocationDisable the "Welcome to Xcode" window
Stop the welcome window from appearing every time you open Xcode:
defaults write com.apple.dt.Xcode XCShowWelcomeWindow -bool falseFaster animation in the Interface Builder
Speed up the animations in the Interface Builder canvas:
defaults write com.apple.dt.Xcode IDEInterfaceBuilderCanvasAnimationSpeed -float 0.1Parallel testing
Set the number of parallel test runners:
defaults write com.apple.dt.Xcode IDESimulatorParallelTestMaxCount -int 4Read all current Xcode settings
defaults read com.apple.dt.XcodeThe output is very long. Filter it:
defaults read com.apple.dt.Xcode | grep -i "DVTText"
defaults read com.apple.dt.Xcode | grep -i "build"Notes
Xcode has hundreds of hidden defaults. The ones above are the most widely used. Many more are documented in Apple developer forums and community blogs.
Some settings use the DVT prefix (Developer Tools) and others use IDE (Integrated Development Environment). Both are valid Xcode settings.
Enjoyed this post?
Well, you could share the post with others, follow me with RSS Feeds and/or send me a comment via email.
Tags
Category:
Tags:
Year: