{"id":13902854,"url":"https://github.com/mapbox/XcodeClangFormat","last_synced_at":"2025-07-18T00:32:17.777Z","repository":{"id":45601302,"uuid":"68093434","full_name":"mapbox/XcodeClangFormat","owner":"mapbox","description":"Format code in Xcode 8+ with clang-format","archived":false,"fork":false,"pushed_at":"2023-04-20T21:23:31.000Z","size":414,"stargazers_count":814,"open_issues_count":11,"forks_count":105,"subscribers_count":128,"default_branch":"master","last_synced_at":"2025-04-21T08:57:00.625Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mapbox.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-09-13T09:16:57.000Z","updated_at":"2025-04-13T13:13:02.000Z","dependencies_parsed_at":"2024-01-19T10:14:01.702Z","dependency_job_id":"82f6a4c6-0b48-4d83-8c81-be2497dc5419","html_url":"https://github.com/mapbox/XcodeClangFormat","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/mapbox/XcodeClangFormat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2FXcodeClangFormat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2FXcodeClangFormat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2FXcodeClangFormat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2FXcodeClangFormat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mapbox","download_url":"https://codeload.github.com/mapbox/XcodeClangFormat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2FXcodeClangFormat/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265685524,"owners_count":23811191,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-06T22:01:27.899Z","updated_at":"2025-07-18T00:32:17.387Z","avatar_url":"https://github.com/mapbox.png","language":"Objective-C++","readme":"# XcodeClangFormat\n\n### [⚙ Download Latest Release](https://github.com/mapbox/XcodeClangFormat/releases/latest)\nUses `clang-format` from [Clang 10](https://releases.llvm.org/10.0.0/tools/clang/docs/ClangFormat.html)\n\n...or install with Homebrew: `brew install --cask xcodeclangformat`\n\nThis plugin is written for Xcode 8's new plugin infrastructure and compatible through at least Xcode 11.4 It uses Clang's `libclangFormat` library to format code according to a `.clang-format` file.\n\nOpen the app, select a predefined style, or open the `.clang-format` file from your project:\n\n![](screenshot-config.png)\n\nThen, use the \u003ckbd\u003eFormat Source Code\u003c/kbd\u003e command in Xcode's \u003ckbd\u003eEditor\u003c/kbd\u003e menu:\n\n![](screenshot-format.png)\n\nDue to macOS sandboxing restrictions, this plugin behaves slightly differently compared to the command line `clang-format` command: It always uses the style selected in the configuration app, and will not use the nearest `.clang-format` file on disk.\n\n\n## Installing\n\nDownload the precompiled app or [build it yourself](#building), then open the app. You might have to right click on the app bundle, and choose \u003ckbd\u003eOpen\u003c/kbd\u003e to run non-codesigned applications. Then,\n\n* On OS X 10.11, you'll need to run `sudo /usr/libexec/xpccachectl`, then **reboot** to enable app extensions.\n* On macOS Sierra and later, extensions should be loaded by default.\n\nThen, go to *System Preferences* → *Extensions*, and make sure that **clang-format** in the *Xcode Source Editor* section is checked:\n\n![](screenshot-extensions.png)\n\n\n## Keyboard shortcut\n\nTo define a keyboard shortcut, open Xcode's preferences, and switch to the *Key Bindings* tab. Duplicate the default key binding set if you don't have your own set already. Search for `clang-format`, then add your preferred key bindings for `Format Selection` or `Format Entire File`.\n\n![](screenshot-shortcut.png)\n\n\n## Building\n\nTo build XcodeClangFormat, run `./configure` on the command line, then build the XcodeClangFormat scheme in the included Xcode project.\n\n\n## FAQ\n\n##### Why aren't you just using the `.clang-format` file in the file's parent folder?\nXcode code formatting extensions are severely limited and don't have access to the file system. They also don't get to know the file name of the file to be changed, so there's no way for this extension to load the correct file.\n\n##### Could you please add “Format on Save”?\nThe Xcode extension mechanism doesn't allow that; the only thing you can do is return the altered source code.\n\n##### Why doesn't the menu item show up?\nIf you're using macOS Sierra, please follow the [installing](#installing) guide. on OS X 10.11, I haven't found a way to make this extension work besides [manually building it](#building).\n\nIf the menu items randomly disappears, quit Xcode. In Finder, [rename `Xcode.app` to something else, then rename it back to `Xcode.app`](https://stackoverflow.com/a/48893833). 🤯\n\n##### When compiling, I'm getting `'clang/Format/Format.h' file not found`.\nMake sure that you're running `./configure` in the root folder. This downloads and unpacks the precompiled libraries and headers from the llvm.org that are required for compiling.\n","funding_links":[],"categories":["Objective-C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2FXcodeClangFormat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmapbox%2FXcodeClangFormat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2FXcodeClangFormat/lists"}