oclint-xcodebuild Manual

For developers who use Xcode, oclint-xcodebuild is a helpful program that extracts adequate compiler options from xcodebuild execution log, converts them into JSON Compilation Database format, and save it into compile_commands.json file.

See also

Read Apple’s official xcodebuild Manual Page from Mac Developer Library. To understand how oclint-xcodebuild can be applied in your workflow, please move onto Using OCLint with xcodebuild document.

Please also consider using xcpretty.

Running oclint-xcodebuild

If a xcodebuild.log file is at the current working directory. Simply run


In case the xcodebuild log is stored in a file with name other than xcodebuild.log, append the path to the log file like

oclint-xcodebuild </path/to/xcodebuild/log>

When certain files are compiled by Xcode but we want to exclude them from the compilation database, we could filter them out by

oclint-xcodebuild -e <exclude_pattern_regex> </path/to/xcodebuild/log>

The compile_commands.json will be generated to the current working directory.

oclint-xcodebuild -o </path/to/output/compile/commands/json> </path/to/xcodebuild/log>

In addition, this will redirect the JSON Compilation Database output to the path specified.


It’s highly recommended to avoid having spaces in your file name or file path. It’s a good practice. Meanwhile, even though oclint itself supports spaces in path, oclint-json-compilation-database and oclint-xcodebuild still have issues handling spaces in path.


oclint-xcodebuild is still an experimental project. The success of it depends on various things, e.g. macOS version, the Xcode version and project settings. However, since developers who use Xcode are familiar with Apple’s manner of supporting only the latest version and one previous version, so oclint-xcodebuild tries to follow this convention. Your feedback is warmly welcome to help improve this helper program.