{"id":26091661,"url":"https://github.com/intercom/cocoapods-mangle","last_synced_at":"2026-04-07T05:31:46.784Z","repository":{"id":37734804,"uuid":"113063268","full_name":"intercom/cocoapods-mangle","owner":"intercom","description":"A CocoaPods plugin which mangles the symbols of your dependencies","archived":false,"fork":false,"pushed_at":"2025-06-16T16:13:28.000Z","size":109,"stargazers_count":52,"open_issues_count":1,"forks_count":5,"subscribers_count":127,"default_branch":"master","last_synced_at":"2026-04-01T02:38:07.661Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/intercom.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-12-04T15:57:26.000Z","updated_at":"2026-03-23T22:18:05.000Z","dependencies_parsed_at":"2024-01-16T12:21:39.678Z","dependency_job_id":"dcddeb82-7172-4e21-9a72-0e40f86b8c66","html_url":"https://github.com/intercom/cocoapods-mangle","commit_stats":{"total_commits":38,"total_committers":6,"mean_commits":6.333333333333333,"dds":0.5,"last_synced_commit":"854bc2d93a663a12336787cfc7c1e99d5e77b694"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/intercom/cocoapods-mangle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intercom%2Fcocoapods-mangle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intercom%2Fcocoapods-mangle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intercom%2Fcocoapods-mangle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intercom%2Fcocoapods-mangle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/intercom","download_url":"https://codeload.github.com/intercom/cocoapods-mangle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intercom%2Fcocoapods-mangle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31501903,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2025-03-09T10:22:45.285Z","updated_at":"2026-04-07T05:31:46.752Z","avatar_url":"https://github.com/intercom.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Intercom](Intercom_logo-github.png)\n\n[![Apache License](http://img.shields.io/badge/license-APACHE2-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0.html)\n[![CircleCI](https://circleci.com/gh/intercom/cocoapods-mangle.svg?style=svg)](https://circleci.com/gh/intercom/cocoapods-mangle)\n\n# cocoapods-mangle\n\ncocoapods-mangle is a CocoaPods plugin which mangles the symbols of your dependencies. Mangling your dependencies' symbols allows more than one copy of a dependency to exist in an app. This is particularly useful for iOS frameworks which do not want to interfere with the host app.\n\n## Installation\n\n    $ gem install cocoapods-mangle\n\n## What is mangling?\n\nMangling or namespacing your dependencies is a way of ensuring that there are no conflicts between multiple copies of the same dependency in an app. This is most useful when developing third-party frameworks.\n\nFor example, if you are developing a framework `MyFramework.framework` and you include `AFNetworking` as a dependency, all `AFNetworking` classes are included in your framework's binary:\n\n```\n➜ nm -gU MyFramework.framework/MyFramework | grep \"_OBJC_CLASS_\\$.*AF.*\"\n00000000000000e0 S _OBJC_CLASS_$_PodsDummy_AFNetworking\n00000000000013f0 S _OBJC_CLASS_$_AFNetworkReachabilityManager\n0000000000001f20 S _OBJC_CLASS_$_AFSecurityPolicy\n000000000000a938 S _OBJC_CLASS_$_AFHTTPBodyPart\n000000000000a898 S _OBJC_CLASS_$_AFHTTPRequestSerializer\n000000000000a9d8 S _OBJC_CLASS_$_AFJSONRequestSerializer\n000000000000a910 S _OBJC_CLASS_$_AFMultipartBodyStream\n000000000000aa28 S _OBJC_CLASS_$_AFPropertyListRequestSerializer\n000000000000a848 S _OBJC_CLASS_$_AFQueryStringPair\n000000000000a8c0 S _OBJC_CLASS_$_AFStreamingMultipartFormData\n0000000000004870 S _OBJC_CLASS_$_AFCompoundResponseSerializer\n00000000000046e0 S _OBJC_CLASS_$_AFHTTPResponseSerializer\n0000000000004820 S _OBJC_CLASS_$_AFImageResponseSerializer\n0000000000004730 S _OBJC_CLASS_$_AFJSONResponseSerializer\n00000000000047d0 S _OBJC_CLASS_$_AFPropertyListResponseSerializer\n0000000000004780 S _OBJC_CLASS_$_AFXMLParserResponseSerializer\n```\n\nThis means that if an app includes both `MyFramework.framework` and `AFNetworking`, the app will fail to build with an error that looks something like:\n\n```\nld: 16 duplicate symbols for architecture x86_64\nclang: error: linker command failed with exit code 1 (use -v to see invocation)\n```\n\nHowever, with mangling enabled through cocoapods-mangle, we can see that the `AFNetworking` classes are now prefixed with `MyFramework_`:\n\n```\n➜ nm -gU MyFramework.framework/MyFramework | grep \"_OBJC_CLASS_\\$.*AF.*\"\n00000000000000e0 S _OBJC_CLASS_$_MyFramework_PodsDummy_AFNetworking\n00000000000013f0 S _OBJC_CLASS_$_MyFramework_AFNetworkReachabilityManager\n0000000000001f20 S _OBJC_CLASS_$_MyFramework_AFSecurityPolicy\n000000000000a938 S _OBJC_CLASS_$_MyFramework_AFHTTPBodyPart\n000000000000a898 S _OBJC_CLASS_$_MyFramework_AFHTTPRequestSerializer\n000000000000a9d8 S _OBJC_CLASS_$_MyFramework_AFJSONRequestSerializer\n000000000000a910 S _OBJC_CLASS_$_MyFramework_AFMultipartBodyStream\n000000000000aa28 S _OBJC_CLASS_$_MyFramework_AFPropertyListRequestSerializer\n000000000000a848 S _OBJC_CLASS_$_MyFramework_AFQueryStringPair\n000000000000a8c0 S _OBJC_CLASS_$_MyFramework_AFStreamingMultipartFormData\n0000000000004870 S _OBJC_CLASS_$_MyFramework_AFCompoundResponseSerializer\n00000000000046e0 S _OBJC_CLASS_$_MyFramework_AFHTTPResponseSerializer\n0000000000004820 S _OBJC_CLASS_$_MyFramework_AFImageResponseSerializer\n0000000000004730 S _OBJC_CLASS_$_MyFramework_AFJSONResponseSerializer\n00000000000047d0 S _OBJC_CLASS_$_MyFramework_AFPropertyListResponseSerializer\n0000000000004780 S _OBJC_CLASS_$_MyFramework_AFXMLParserResponseSerializer\n```\n\nThe app that includes both `MyFramework.framework` and `AFNetworking` will now build successfully 🎉\n\n## How it works\n\nAs demonstrated above, `nm` can be used to inspect the symbols such as classes, constants and selectors in a Mach-O binary. When you run `pod install`, cocoapods-mangle builds your dependencies if they have changed, and parses the output of `nm`. It places this output in an `xcconfig` file that looks something like this:\n\n```\nMANGLING_DEFINES = PodsDummy_AFNetworking=MyFramework_PodsDummy_AFNetworking AFNetworkReachabilityManager=MyFramework_AFNetworkReachabilityManager AFSecurityPolicy=MyFramework_AFSecurityPolicy AFHTTPBodyPart=MyFramework_AFHTTPBodyPart AFHTTPRequestSerializer=MyFramework_AFHTTPRequestSerializer AFJSONRequestSerializer=MyFramework_AFJSONRequestSerializer AFMultipartBodyStream=MyFramework_AFMultipartBodyStream AFPropertyListRequestSerializer=MyFramework_AFPropertyListRequestSerializer AFQueryStringPair=MyFramework_AFQueryStringPair AFStreamingMultipartFormData=MyFramework_AFStreamingMultipartFormData AFCompoundResponseSerializer=MyFramework_AFCompoundResponseSerializer AFHTTPResponseSerializer=MyFramework_AFHTTPResponseSerializer AFImageResponseSerializer=MyFramework_AFImageResponseSerializer AFJSONResponseSerializer=MyFramework_AFJSONResponseSerializer AFPropertyListResponseSerializer=MyFramework_AFPropertyListResponseSerializer AFXMLParserResponseSerializer=MyFramework_AFXMLParserResponseSerializer\n\nMANGLED_SPECS_CHECKSUM = 18f61e6e6172fb87ddc7341f3537f30f8c7a3edc\n```\n\nThis is included in `GCC_PREPROCESSOR_DEFINITIONS` of the `xcconfig` file for every target. All of these symbols will be mangled on subsequent builds.\n\nThe symbols that will be mangled are:\n\n- Objective C classes. e.g. `AFNetworkReachabilityManager` becomes `MyFramework_AFNetworkReachabilityManager`.\n- C and Objective C constants. `AFNetworkingReachabilityDidChangeNotification` becomes `MyFramework_AFNetworkingReachabilityDidChangeNotification`.\n- Objective C category selectors. The first component of the selector is mangled. e.g. `-[NSString xxx_abc:def]` becomes `-[NSString MyFramework_xxx_abc:def]`.\n\nThe plugin has only been fully tested with Objective C dependencies. There is no reason why this could not also work for Swift.\n\n## Usage\n\ncocoapods-mangle can be used by adding it to your `Podfile` like this:\n\n```\nsource 'https://github.com/CocoaPods/Specs.git'\n\nplatform :ios, '8.0'\nplugin 'cocoapods-mangle'\n\ntarget :MyTarget do\n  # Dependencies here\nend\n\n```\n\nNow, each time you run `pod install`, cocoapods-mangle updates the `xcconfig` files for all targets to ensure that all symbols in your dependencies are mangled.\n\nThe plugin can be optionally configured with `:xcconfig_path`, `:mangle_prefix` or `:targets`. Here is an example:\n\n```\nplugin 'cocoapods-mangle', targets: ['MyTarget'],\n                           mangle_prefix: 'Prefix_'\n                           xcconfig_path: 'path/to/mangle.xcconfig'\n```\n\n## Caveats\n\n- cocoapods-mangle will only work for source dependencies. Pre-compiled frameworks cannot be mangled.\n- Currently only supports iOS. It should be very straightforward to extend support to macOS, tvOS or watchOS.\n- Category mangling may cause issues if the dependency does not correctly prefix its category selectors (see http://nshipster.com/namespacing/#method-prefixes).\n- Usage of `NSClassFromString(@\"MyClass\")` will not work after mangling has been applied. You will need to use `NSClassFromString(@\"Prefix_MyClass\")` for this to work correctly.\n\n## Related links\n\n- [CocoaPods Packager](https://github.com/cocoapods/cocoapods-packager) has similar mangling functionality for packaging `.podspec` files.\n- http://blog.sigmapoint.pl/avoiding-dependency-collisions-in-ios-static-library-managed-by-cocoapods/\n- http://pdx.esri.com/blog/namespacing-dependencies/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintercom%2Fcocoapods-mangle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintercom%2Fcocoapods-mangle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintercom%2Fcocoapods-mangle/lists"}