macholib can be used to analyze and edit Mach-O headers, the executable
format used by Mac OS X.
It's typically used as a dependency analysis tool, and also to rewrite dylib
references in Mach-O headers to be @executable_path relative.
Though this tool targets a platform specific file format, it is pure python
code that is platform and endian independent.
CI Status
---------
* .. image:: https://github.com/ronaldoussoren/macholib/workflows/Lint/badge.svg
* .. image:: https://github.com/ronaldoussoren/macholib/workflows/Test/badge.svg
Project links
-------------
* `Documentation <https://macholib.readthedocs.io/en/latest/>`_
* `Issue Tracker <https://github.com/ronaldoussoren/macholib>`_
* `Repository <https://github.com/ronaldoussoren/macholib/>`_
Release history
===============
macholib 1.16.2
---------------
* Update classifiers for Python 3.11
macholib 1.16.1
---------------
* Added some new CPU subtype definitions
macholib 1.16
-------------
* Add ``allow_unknown_load_commands`` option to ``MachO`` and
```macholib.MachOHeader``.
PR by github user bhamiltoncx.
macholib 1.15.2
---------------
* Explicitly mention Python 3.10 in the project metadata
macholib 1.15.1
---------------
* Remove a debug print introduced in the previous release.
macholib 1.15
---------------
* Add support for new features in the macOS 11 SDK
* Fix link to repository in README.rst
* Fix ``macholib.dyld.dyld_find`` for system libraries on macOS 11 or later
macholib 1.14
-------------
* Repository moved to GitHub
* #32: Update the LC_NAMES table
macholib 1.13
-------------
# 31: Add two new load commands introduced in macOS 10.15
macholib 1.12
-------------
* #27: Missing describe method for build_version_command
macholib 1.11
-------------
* Add very hacky limited support for @loader_path. This is just
enough to deal with extensions and dylibs found in Python
binary wheels.
macholib 1.10
-------------
* #25: Add support for LC_NOTE and LC_BUILD_VERSION
macholib 1.9
------------
Features:
* Add definition for ``macholib.mach_o.reloc_type_generic``, which
was used in code but never defined.
* #22: Add LICENSE file
* #23: Added "--help" option for "python -m macholib"
* Added function ``macholib.MachO.lc_str_value`` which should
help in decoding value of ``macholib.mach_o.lc_str``. Those
values are offsets in the data of a load command, the function
will return the actually value as a byte string.
See also issue #21.
Bug fixes:
* Pull request #15: Fix typo in thread_command class
Patch by user "phdphuc" on bitbucket.
macholib 1.8
------------
* Use the same dependency walk logic as otool
Patch by Taras Tsugrii <ttsugrii@fb.com>
* Added support for new load commands
Patch by David Dorsey <trogdorsey@gmail.com>,
with enhancements by Ronald Oussoren.
* Fix procesing DSYM file from XCODE 6.x
Patch by HolmsBlazhey <andrey.blazhey@gmail.com>
* MachOGraph.locate(): When calling dyld_find(), use kwarg 'loader_path', not 'loader'.
Patch by Stuart Berg <bergs@janelia.hhmi.org>
* Add fields to thread_command
Patch by Asger Hautop Drewsen <asgerdrewsen@gmail.com>
* Add missing ARM_V7S subtype.
Patch by "NN"
* Fix for SymbolTable
Patch by Christian Klein <chris@5711.org>
* Use first Mach-O header as the default header
Patch by Christian Klein <chris@5711.org>
* Issue #17: add LC_LOAD_UPWARD_DYLIB to _RELOCATABLE set
* Issue #16: macholib "hangs" on invalid input
Due to the use of the range function on untrusted input
the python process could hang when reading invalid input, due
to trying to construct an enormous list.
* Issue #18: Bad version parsing in macho_version_helper
The order of subfields in ``mach_version_helper`` was reversed from
reality.
* Issue #19: Fix aligment issue that prevented code signing
Patch by Brendan Simon
* Fix issue #14: Can't pass endian argument to p_uint64.from_str
macholib 1.7
------------
* Added support for ARM64, LC_ENCRYPTION_INFO_64 and LC_LINKER_OPTION
Patch by Matthias Ringwald.
* Load commands now have a "describe" method that returns more information
about the command.
Patch by David Dorsey.
* The MAGIC value in the header was always represented in the native
byte order, instead of as the value read from the binary.
Patch by David Dorsey.
* Added various new constants to "macholib.mach_o".
Patch by David Dorsey.
macholib 1.6.1
--------------
* ?
macholib 1.6
------------
* Add support for '@loader_path' link command in
macholib.dyld:
- Added function ``macholib.dyld.dyld_loader_search``
- This function is used by ``macholib.dyld.dyld_find``,
and that function now has an new (optional) argument
with the path to the loader.
* Also add support for '@loader_path' to macholib.MachoGraph,
using the newly added '@loader_path' support in the
dyld module.
Due to this suppport the *macho_standalone* tool can
now rewrite binaries that contain an '@loader_path' load
command.
macholib 1.5.2
--------------
* Issue #93: Show the name of the affected file in the exception message
for Mach-O headers that are too large to relocate.
macholib 1.5.1
--------------
* There were no 'classifiers' in the package metadata due to
a bug in setup.py.
macholib 1.5
--------------
macholib 1.5 is a minor feature release
* No longer use 2to3 to provide Python 3 support
As a side-effect of this macholib no longer supports
Python 2.5 and earlier.
* Adds suppport for some new macho load commands
* Fix for py3k problem in macho_standalone.py
Patch by Guanqun Lu.
* Fix for some issues in macho_dump.py
Patch by Nam Nguyen
* Issue #10: Fix for LC_DATA_IN_CODE linker commands, without
this fix py2app cannot build application bundles when
the source binaries have been compiled with Xcode 4.5.
* Issue #6: Fix for LC_ENCRYPTION_INFO linker commands
* Use the mach header information to print the cpu type of a
binary, instead of trying to deduce that from pointer width
and endianness.
Changed the code because of issue #6, in which a user tries to
dump a iOS binary which results in bogus output in the previous
releases.
* The mapping ``macholib.macho_dump.ARCH_MAP`` is undocumented
and no longer used by macholib itself. It will be removed
in the next release.
* The command-line tools ``macho_find``, ``macho_dump`` and
``macho_standalone`` are deprecated. Use "python -mmacholib"
instead. That is::
$ python -mmacholib dump /usr/bin/grep
$ python -mmacholib find ~
$ python -mmacholib standalone myapp.app
This makes it clearer which version of the tools are used.
macholib 1.4.3
--------------
macholib 1.4.3 is a minor feature release
* Added strings for 'x86_64' and 'ppc64' to
macholib.mach_o.CPU_TYPE_NAMES.
* macho_find and macho_dump were broken in the 1.4.2 release
* added 'macholib.util.NOT_SYSTEM_FILES', a list of
files that aren't system path's even though they are
located in system locations.
Needed to work around a bug in PySide (see issue #32 in the
py2app tracker)
macholib 1.4.2
--------------
macholib 1.4.2 is a minor bugfix release
* The support for new load commands that was added in 1.4.1
contained a typo that caused problems on OSX 10.7 (Lion).
macholib 1.4.1
--------------
macholib 1.4.1 is a minor feature release
Features:
- Add support for a number of new MachO load commands that were added
during the lifetime of OSX 10.6: ``LC_LOAD_UPWARD_DYLIB``,
``LC_VERSION_MIN_MACOSX``, ``LC_VERSION_MIN_IPHONEOS`` and
``LC_FUNCTION_STARTS``.
macholib 1.4
-------------
macholib 1.4 is a feature release
Features:
- Documentation is now generated using `sphinx <http://pypi.python.org/pypi/sphinx>`_
and can be viewed at <http://packages.python.org/macholib>.
- The repository has moved to bitbucket
- There now is a testsuite
- Private functionality inside modules was renamed to
a name starting with an underscore.
.. note:: if this change affects your code you are relying on undefined
implementation features, please stop using private functions.
- The basic packable types in ``macholib.ptypes`` were renamed to better
represent the corresponding C type. The table below lists the old
an new names (the old names are still available, but are deprecated and
will be removed in a future release).
+--------------+--------------+
| **Old name** | **New name** |
+==============+==============+
| p_byte | p_int8 |
+--------------+--------------+
| p_ubyte | p_uint8 |
+--------------+--------------+
| p_short | p_int16 |
+--------------+--------------+
| p_ushort | p_uint16 |
+--------------+--------------+
| p_int | p_int32 |
+--------------+--------------+
| p_uint | p_uint32 |
+--------------+--------------+
| p_long | p_int32 |
+--------------+--------------+
| p_ulong | p_uint32 |
+--------------+--------------+
| p_longlong | p_int64 |
+--------------+--------------+
| p_ulonglong | p_uint64 |
+--------------+--------------+
``Macholib.ptypes.p_ptr`` is no longer present as it had an unclear
definition and isn't actually used in the codebase.
Bug fixes:
- The semantics of ``dyld.dyld_default_search`` were changed a bit,
it now first searches the framework path (if appropriate) and then
the linker path, irrespective of the value of the ``DYLD_FALLBACK*``
environment variables.
Previous versions would change the search order when those variables
was set, which is odd and doesn't correspond with the documented
behaviour of the system dyld.
- It is once again possible to install using python2.5
- The source distribution includes all files, this was broken
due to the switch to mercurial (which confused setuptools)
macholib 1.3
------------
macholib 1.3 is a feature release.
Features:
- Experimental Python 3.x support
This version contains lightly tested support for Python 3.
macholib 1.2.2
--------------
macholib 1.2.2 is a bugfix release.
Bug fixes:
- Macholib should work better with 64-bit code
(patch by Marc-Antoine Parent)
Raw data
{
"_id": null,
"home_page": "http://github.com/ronaldoussoren/macholib",
"name": "macholib",
"maintainer": "Ronald Oussoren",
"docs_url": "https://pythonhosted.org/macholib/",
"requires_python": "",
"maintainer_email": "ronaldoussoren@mac.com",
"keywords": "Mach-O,,dyld",
"author": "Ronald Oussoren",
"author_email": "ronaldoussoren@mac.com",
"download_url": "https://files.pythonhosted.org/packages/95/ee/af1a3842bdd5902ce133bd246eb7ffd4375c38642aeb5dc0ae3a0329dfa2/macholib-1.16.3.tar.gz",
"platform": "any",
"description": "macholib can be used to analyze and edit Mach-O headers, the executable\nformat used by Mac OS X.\n\nIt's typically used as a dependency analysis tool, and also to rewrite dylib\nreferences in Mach-O headers to be @executable_path relative.\n\nThough this tool targets a platform specific file format, it is pure python\ncode that is platform and endian independent.\n\nCI Status\n---------\n\n* .. image:: https://github.com/ronaldoussoren/macholib/workflows/Lint/badge.svg\n* .. image:: https://github.com/ronaldoussoren/macholib/workflows/Test/badge.svg\n\nProject links\n-------------\n\n* `Documentation <https://macholib.readthedocs.io/en/latest/>`_\n\n* `Issue Tracker <https://github.com/ronaldoussoren/macholib>`_\n\n* `Repository <https://github.com/ronaldoussoren/macholib/>`_\n\n\nRelease history\n===============\n\nmacholib 1.16.2\n---------------\n\n* Update classifiers for Python 3.11\n\nmacholib 1.16.1\n---------------\n\n* Added some new CPU subtype definitions\n\nmacholib 1.16\n-------------\n\n* Add ``allow_unknown_load_commands`` option to ``MachO`` and\n ```macholib.MachOHeader``.\n\n PR by github user bhamiltoncx.\n\n\nmacholib 1.15.2\n---------------\n\n* Explicitly mention Python 3.10 in the project metadata\n\nmacholib 1.15.1\n---------------\n\n* Remove a debug print introduced in the previous release.\n\nmacholib 1.15\n---------------\n\n* Add support for new features in the macOS 11 SDK\n\n* Fix link to repository in README.rst\n\n* Fix ``macholib.dyld.dyld_find`` for system libraries on macOS 11 or later\n\nmacholib 1.14\n-------------\n\n* Repository moved to GitHub\n\n* #32: Update the LC_NAMES table\n\nmacholib 1.13\n-------------\n\n# 31: Add two new load commands introduced in macOS 10.15\n\nmacholib 1.12\n-------------\n\n* #27: Missing describe method for build_version_command\n\nmacholib 1.11\n-------------\n\n* Add very hacky limited support for @loader_path. This is just\n enough to deal with extensions and dylibs found in Python\n binary wheels.\n\nmacholib 1.10\n-------------\n\n* #25: Add support for LC_NOTE and LC_BUILD_VERSION\n\nmacholib 1.9\n------------\n\nFeatures:\n\n* Add definition for ``macholib.mach_o.reloc_type_generic``, which\n was used in code but never defined.\n\n* #22: Add LICENSE file\n\n* #23: Added \"--help\" option for \"python -m macholib\"\n\n* Added function ``macholib.MachO.lc_str_value`` which should\n help in decoding value of ``macholib.mach_o.lc_str``. Those\n values are offsets in the data of a load command, the function\n will return the actually value as a byte string.\n\n See also issue #21.\n\nBug fixes:\n\n* Pull request #15: Fix typo in thread_command class\n\n Patch by user \"phdphuc\" on bitbucket.\n\nmacholib 1.8\n------------\n\n* Use the same dependency walk logic as otool\n\n Patch by Taras Tsugrii <ttsugrii@fb.com>\n\n* Added support for new load commands\n\n Patch by David Dorsey <trogdorsey@gmail.com>,\n with enhancements by Ronald Oussoren.\n\n* Fix procesing DSYM file from XCODE 6.x\n\n Patch by HolmsBlazhey <andrey.blazhey@gmail.com>\n\n* MachOGraph.locate(): When calling dyld_find(), use kwarg 'loader_path', not 'loader'.\n\n Patch by Stuart Berg <bergs@janelia.hhmi.org>\n\n* Add fields to thread_command\n\n Patch by Asger Hautop Drewsen <asgerdrewsen@gmail.com>\n\n* Add missing ARM_V7S subtype.\n\n Patch by \"NN\"\n\n* Fix for SymbolTable\n\n Patch by Christian Klein <chris@5711.org>\n\n* Use first Mach-O header as the default header\n\n Patch by Christian Klein <chris@5711.org>\n\n* Issue #17: add LC_LOAD_UPWARD_DYLIB to _RELOCATABLE set\n\n* Issue #16: macholib \"hangs\" on invalid input\n\n Due to the use of the range function on untrusted input\n the python process could hang when reading invalid input, due\n to trying to construct an enormous list.\n\n* Issue #18: Bad version parsing in macho_version_helper\n\n The order of subfields in ``mach_version_helper`` was reversed from\n reality.\n\n* Issue #19: Fix aligment issue that prevented code signing\n\n Patch by Brendan Simon\n\n* Fix issue #14: Can't pass endian argument to p_uint64.from_str\n\n\nmacholib 1.7\n------------\n\n* Added support for ARM64, LC_ENCRYPTION_INFO_64 and LC_LINKER_OPTION\n\n Patch by Matthias Ringwald.\n\n* Load commands now have a \"describe\" method that returns more information\n about the command.\n\n Patch by David Dorsey.\n\n* The MAGIC value in the header was always represented in the native\n byte order, instead of as the value read from the binary.\n\n Patch by David Dorsey.\n\n* Added various new constants to \"macholib.mach_o\".\n\n Patch by David Dorsey.\n\nmacholib 1.6.1\n--------------\n\n* ?\n\nmacholib 1.6\n------------\n\n* Add support for '@loader_path' link command in\n macholib.dyld:\n\n - Added function ``macholib.dyld.dyld_loader_search``\n\n - This function is used by ``macholib.dyld.dyld_find``,\n and that function now has an new (optional) argument\n with the path to the loader.\n\n* Also add support for '@loader_path' to macholib.MachoGraph,\n using the newly added '@loader_path' support in the\n dyld module.\n\n Due to this suppport the *macho_standalone* tool can\n now rewrite binaries that contain an '@loader_path' load\n command.\n\n\nmacholib 1.5.2\n--------------\n\n* Issue #93: Show the name of the affected file in the exception message\n for Mach-O headers that are too large to relocate.\n\n\nmacholib 1.5.1\n--------------\n\n* There were no 'classifiers' in the package metadata due to\n a bug in setup.py.\n\nmacholib 1.5\n--------------\n\nmacholib 1.5 is a minor feature release\n\n* No longer use 2to3 to provide Python 3 support\n\n As a side-effect of this macholib no longer supports\n Python 2.5 and earlier.\n\n* Adds suppport for some new macho load commands\n\n* Fix for py3k problem in macho_standalone.py\n\n Patch by Guanqun Lu.\n\n* Fix for some issues in macho_dump.py\n\n Patch by Nam Nguyen\n\n* Issue #10: Fix for LC_DATA_IN_CODE linker commands, without\n this fix py2app cannot build application bundles when\n the source binaries have been compiled with Xcode 4.5.\n\n* Issue #6: Fix for LC_ENCRYPTION_INFO linker commands\n\n* Use the mach header information to print the cpu type of a\n binary, instead of trying to deduce that from pointer width\n and endianness.\n\n Changed the code because of issue #6, in which a user tries to\n dump a iOS binary which results in bogus output in the previous\n releases.\n\n* The mapping ``macholib.macho_dump.ARCH_MAP`` is undocumented\n and no longer used by macholib itself. It will be removed\n in the next release.\n\n\n* The command-line tools ``macho_find``, ``macho_dump`` and\n ``macho_standalone`` are deprecated. Use \"python -mmacholib\"\n instead. That is::\n\n $ python -mmacholib dump /usr/bin/grep\n\n $ python -mmacholib find ~\n\n $ python -mmacholib standalone myapp.app\n\n This makes it clearer which version of the tools are used.\n\nmacholib 1.4.3\n--------------\n\nmacholib 1.4.3 is a minor feature release\n\n* Added strings for 'x86_64' and 'ppc64' to\n macholib.mach_o.CPU_TYPE_NAMES.\n\n* macho_find and macho_dump were broken in the 1.4.2 release\n\n* added 'macholib.util.NOT_SYSTEM_FILES', a list of\n files that aren't system path's even though they are\n located in system locations.\n\n Needed to work around a bug in PySide (see issue #32 in the\n py2app tracker)\n\n\n\nmacholib 1.4.2\n--------------\n\nmacholib 1.4.2 is a minor bugfix release\n\n* The support for new load commands that was added in 1.4.1\n contained a typo that caused problems on OSX 10.7 (Lion).\n\nmacholib 1.4.1\n--------------\n\nmacholib 1.4.1 is a minor feature release\n\nFeatures:\n\n- Add support for a number of new MachO load commands that were added\n during the lifetime of OSX 10.6: ``LC_LOAD_UPWARD_DYLIB``,\n ``LC_VERSION_MIN_MACOSX``, ``LC_VERSION_MIN_IPHONEOS`` and\n ``LC_FUNCTION_STARTS``.\n\nmacholib 1.4\n-------------\n\nmacholib 1.4 is a feature release\n\nFeatures:\n\n- Documentation is now generated using `sphinx <http://pypi.python.org/pypi/sphinx>`_\n and can be viewed at <http://packages.python.org/macholib>.\n\n- The repository has moved to bitbucket\n\n- There now is a testsuite\n\n- Private functionality inside modules was renamed to\n a name starting with an underscore.\n\n .. note:: if this change affects your code you are relying on undefined\n implementation features, please stop using private functions.\n\n- The basic packable types in ``macholib.ptypes`` were renamed to better\n represent the corresponding C type. The table below lists the old\n an new names (the old names are still available, but are deprecated and\n will be removed in a future release).\n\n +--------------+--------------+\n | **Old name** | **New name** |\n +==============+==============+\n | p_byte | p_int8 |\n +--------------+--------------+\n | p_ubyte | p_uint8 |\n +--------------+--------------+\n | p_short | p_int16 |\n +--------------+--------------+\n | p_ushort | p_uint16 |\n +--------------+--------------+\n | p_int | p_int32 |\n +--------------+--------------+\n | p_uint | p_uint32 |\n +--------------+--------------+\n | p_long | p_int32 |\n +--------------+--------------+\n | p_ulong | p_uint32 |\n +--------------+--------------+\n | p_longlong | p_int64 |\n +--------------+--------------+\n | p_ulonglong | p_uint64 |\n +--------------+--------------+\n\n ``Macholib.ptypes.p_ptr`` is no longer present as it had an unclear\n definition and isn't actually used in the codebase.\n\n\nBug fixes:\n\n- The semantics of ``dyld.dyld_default_search`` were changed a bit,\n it now first searches the framework path (if appropriate) and then\n the linker path, irrespective of the value of the ``DYLD_FALLBACK*``\n environment variables.\n\n Previous versions would change the search order when those variables\n was set, which is odd and doesn't correspond with the documented\n behaviour of the system dyld.\n\n- It is once again possible to install using python2.5\n\n- The source distribution includes all files, this was broken\n due to the switch to mercurial (which confused setuptools)\n\nmacholib 1.3\n------------\n\nmacholib 1.3 is a feature release.\n\nFeatures:\n\n- Experimental Python 3.x support\n\n This version contains lightly tested support for Python 3.\n\nmacholib 1.2.2\n--------------\n\nmacholib 1.2.2 is a bugfix release.\n\nBug fixes:\n\n- Macholib should work better with 64-bit code\n (patch by Marc-Antoine Parent)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Mach-O header analysis and editing",
"version": "1.16.3",
"project_urls": {
"Documentation": "https://macholib.readthedocs.io/en/latest/",
"Download": "http://pypi.python.org/pypi/macholib",
"Homepage": "http://github.com/ronaldoussoren/macholib",
"Issue tracker": "https://github.com/ronaldoussoren/macholib/issues",
"Repository": "https://github.com/ronaldoussoren/macholib"
},
"split_keywords": [
"mach-o",
"",
"dyld"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d15dc059c180c84f7962db0aeae7c3b9303ed1d73d76f2bfbc32bc231c8be314",
"md5": "799e531b0597ea4d028c0672334f24ce",
"sha256": "0e315d7583d38b8c77e815b1ecbdbf504a8258d8b3e17b61165c6feb60d18f2c"
},
"downloads": -1,
"filename": "macholib-1.16.3-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "799e531b0597ea4d028c0672334f24ce",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 38094,
"upload_time": "2023-09-25T09:10:14",
"upload_time_iso_8601": "2023-09-25T09:10:14.188841Z",
"url": "https://files.pythonhosted.org/packages/d1/5d/c059c180c84f7962db0aeae7c3b9303ed1d73d76f2bfbc32bc231c8be314/macholib-1.16.3-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "95eeaf1a3842bdd5902ce133bd246eb7ffd4375c38642aeb5dc0ae3a0329dfa2",
"md5": "e1cb59e281ef2958d94e4d9546d67e63",
"sha256": "07ae9e15e8e4cd9a788013d81f5908b3609aa76f9b1421bae9c4d7606ec86a30"
},
"downloads": -1,
"filename": "macholib-1.16.3.tar.gz",
"has_sig": false,
"md5_digest": "e1cb59e281ef2958d94e4d9546d67e63",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 59309,
"upload_time": "2023-09-25T09:10:16",
"upload_time_iso_8601": "2023-09-25T09:10:16.155307Z",
"url": "https://files.pythonhosted.org/packages/95/ee/af1a3842bdd5902ce133bd246eb7ffd4375c38642aeb5dc0ae3a0329dfa2/macholib-1.16.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-25 09:10:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ronaldoussoren",
"github_project": "macholib",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "macholib"
}