{"id":13528148,"url":"https://github.com/chearon/macpack","last_synced_at":"2025-03-22T04:30:37.393Z","repository":{"id":57439042,"uuid":"73660755","full_name":"chearon/macpack","owner":"chearon","description":"Makes a macOS binary redistributable by searching the dependency tree and copying/patching non-system libraries.","archived":false,"fork":false,"pushed_at":"2020-02-05T16:45:57.000Z","size":14,"stargazers_count":25,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T19:52:14.267Z","etag":null,"topics":["app","binary","bundle","bundler","dylib","macos","package","redistributable"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chearon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-14T02:52:48.000Z","updated_at":"2025-03-09T17:04:34.000Z","dependencies_parsed_at":"2022-09-19T13:51:26.972Z","dependency_job_id":null,"html_url":"https://github.com/chearon/macpack","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chearon%2Fmacpack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chearon%2Fmacpack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chearon%2Fmacpack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chearon%2Fmacpack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chearon","download_url":"https://codeload.github.com/chearon/macpack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244907420,"owners_count":20529850,"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":["app","binary","bundle","bundler","dylib","macos","package","redistributable"],"created_at":"2024-08-01T06:02:14.867Z","updated_at":"2025-03-22T04:30:37.088Z","avatar_url":"https://github.com/chearon.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Overview\n\nBundles up all dependencies used by an executable (or library) into a single\nfolder, and patches all of the executables to look in that directory so you\ndon't have to rely on your users having certain libraries installed.\n\nPart of my motivation in making this was to learn Python 3's\n[async/await](https://docs.python.org/3/library/asyncio-task.html), too. The\nprocesses that are used to patch stuff and query dependencies all run in\nparallel so it should be super fast!\n\n# Usage and requirements\n\nYou need:\n\n* Python 3 (`brew install python3`) because it uses async/await and asyncio\n* Xcode CLI tools (I think)\n\nThe easiest way to get going is by installing through pip + PyPi:\n\n```\npip3 install macpack\nmacpack \u003cyour executable here\u003e\n```\n\nYou can also run it out of the project directory by doing:\n\n```\nmacpack/patcher.py \u003cyour executable here\u003e\n```\n\nIt should print the dependency tree like this example:\n\n```\n$ macpack ~/Code/node-canvas/build/Release/canvas.node\nPatching /Users/caleb/Code/node-canvas/build/Release/canvas.node\n16 total non-system dependencies\n1       libpixman-1.0.dylib -\u003e 1\n2       libcairo.2.dylib -\u003e 2, 1, 16, 9, 3\n3       libpng16.16.dylib -\u003e 3\n4       libpangocairo-1.0.0.dylib -\u003e 4, 5, 2, 14, 6, 13, 7, 8, 15, 16, 9\n5       libpango-1.0.0.dylib -\u003e 5, 6, 13, 7, 8\n6       libgobject-2.0.0.dylib -\u003e 6, 7, 11, 12, 8\n7       libglib-2.0.0.dylib -\u003e 7, 11, 8\n8       libintl.8.dylib -\u003e 8\n9       libfreetype.6.dylib -\u003e 9, 3\n10      libjpeg.8.dylib -\u003e 10\n11      libpcre.1.dylib -\u003e 11\n12      libffi.6.dylib -\u003e 12\n13      libgthread-2.0.0.dylib -\u003e 13, 7, 11, 8\n14      libpangoft2-1.0.0.dylib -\u003e 14, 5, 6, 13, 7, 8, 15, 16, 9\n15      libharfbuzz.0.dylib -\u003e 15, 7, 8, 9\n16      libfontconfig.1.dylib -\u003e 16, 9\n\ncanvas.node + 16 dependencies successfully patched\n```\n\nEverything that your executable uses should then be copied into the same folder\nthat your binary is. When your main binary is run next, it will look in the new\nlocation you specified (default is `binary_dir/libs/\u003clib\u003e`, see `-d` below).\nThose dylibs will look in the same directory for dylibs they depend on, too, even\nif your main binary does not use them.\n\nYou can then distribute the whole folder as one.\n\n# Options\n\n## -v, --verbose\n\nPass `-v` to get output from `otool` if it failed to patch or more information on \nwhich dependencies could not be loaded.\n\nIt will also print a more easy to read dependency tree, with the full names of\ndependenies under each one\n\n## -d, --destination\n\nThis is the destination folder **relative to the binary's containing folder** to\ncopy library dependencies to. For example, if you binary is `/a/b/program`,\nand you pass `-d ../libraries`, they will copy to and load from\n`/a/libraries/`. The default value is `../libs`.\n\nIf you want the executable and libraries to have absolute paths instead of loading\nrelative to the binary, you just need to specify an absolutep path for `-d`. In\nthat case the `@executable_path` will not be put into the binaries at all.\n\n## -n, --dry-run\n\nJust prints the dependency tree and doesn't do any patching. Use `-nv` to get a\nslightly more user-friendly tree printed out.\n\n# Background\nIt will parse out the executable's dependencies (using `otool -L`) and their\ndependencies recursively, filtering out system libraries. When the tree\nis built, it will copy the libraries to your program's folder and then patch\neverything that it is aware of (using `install_name_tool`). It should be able\nto handle different symbolic links and all that correctly\n\n# Credits\nInspired by [macdylibbundler](https://github.com/auriamg/macdylibbundler), it does\nthe same basic thing except with less options (at the moment) and it builds a full\ndependency tree\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchearon%2Fmacpack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchearon%2Fmacpack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchearon%2Fmacpack/lists"}