### macholib.dyld.dyld_fallback_framework_path Source: https://github.com/ronaldoussoren/macholib/blob/master/doc/dyld.md Returns a user-specified list of directories for framework search when not in their install path, respecting DYLD_FALLBACK_FRAMEWORK_PATH. Returns an empty list if the default fallback path should be used. ```APIDOC ## macholib.dyld.dyld_fallback_framework_path() ### Description Return a user specified list of of directories where to look for frameworks that aren’t in their install path, or an empty list when the default fallback path should be used. The *env* argument is a dictionary, which defaults to `os.environ`. See the description of `DYLD_FALLBACK_FRAMEWORK_PATH` in the manual page for dyld(1) for more information. ### Parameters #### Query Parameters - **env** (dict) - Optional - A dictionary representing environment variables, defaults to `os.environ`. ``` -------------------------------- ### macholib.dyld.dyld_fallback_library_path Source: https://github.com/ronaldoussoren/macholib/blob/master/doc/dyld.md Returns a user-specified list of directories for library search when not in their install path, respecting DYLD_FALLBACK_LIBRARY_PATH. Returns an empty list if the default fallback path should be used. ```APIDOC ## macholib.dyld.dyld_fallback_library_path() ### Description Return a user specified list of of directories where to look for libraries that aren’t in their install path, or an empty list when the default fallback path should be used. The *env* argument is a dictionary, which defaults to `os.environ`. See the description of `DYLD_FALLBACK_LIBRARY_PATH` in the manual page for dyld(1) for more information. ### Parameters #### Query Parameters - **env** (dict) - Optional - A dictionary representing environment variables, defaults to `os.environ`. ``` -------------------------------- ### Find MachO Binaries Source: https://github.com/ronaldoussoren/macholib/blob/master/doc/scripts.md Use this command to locate all MachO binaries within specified directories. No special setup is required beyond having the macholib library installed. ```bash python -mmacholib find dir... ``` -------------------------------- ### macholib.dyld.dyld_executable_path_search Source: https://github.com/ronaldoussoren/macholib/blob/master/doc/dyld.md If the name starts with '@executable_path/', yields the path relative to the specified executable_path. Yields nothing if executable_path is None. ```APIDOC ## macholib.dyld.dyld_executable_path_search(name, executable_path) ### Description If *name* is a path starting with `@executable_path/` yield the path relative to the specified *executable_path*. If *executable_path* is None nothing is yielded. ### Parameters #### Path Parameters - **name** (str) - Required - The name of the library or framework, potentially prefixed with `@executable_path/`. - **executable_path** (str) - Required - The filesystem path of the executable. ``` -------------------------------- ### macholib.dyld.dyld_loader_search Source: https://github.com/ronaldoussoren/macholib/blob/master/doc/dyld.md If the name starts with '@loader_path/', yields the path relative to the specified loader_path. Yields nothing if loader_path is None. ```APIDOC ## macholib.dyld.dyld_loader_search(name, loader_path) ### Description If *name* is a path starting with `@loader_path/` yield the path relative to the specified *loader_path*. If *loader_path* is None nothing is yielded. ### Parameters #### Path Parameters - **name** (str) - Required - The name of the library or framework, potentially prefixed with `@loader_path/`. - **loader_path** (str) - Required - The filesystem path of the object file referencing the library. ``` -------------------------------- ### Dump Mach-O File Information Source: https://github.com/ronaldoussoren/macholib/blob/master/doc/scripts.md Prints detailed information about all architectures within a Mach-O file and lists all libraries it depends on. This is useful for understanding binary dependencies and structure. ```bash python -mmacholib dump dir... ``` -------------------------------- ### macholib.dyld.dydl_framework_path Source: https://github.com/ronaldoussoren/macholib/blob/master/doc/dyld.md Returns a user-specified framework search path, respecting the DYLD_FRAMEWORK_PATH environment variable. Returns an empty list if only the default search path should be used. ```APIDOC ## macholib.dyld.dydl_framework_path() ### Description Returns a user-specified framework search path, or an empty list when only the default search path should be used. The *env* argument is a dictionary, which defaults to `os.environ`. See the description of `DYLD_FRAMEWORK_PATH` in the manual page for dyld(1) for more information. ### Parameters #### Query Parameters - **env** (dict) - Optional - A dictionary representing environment variables, defaults to `os.environ`. ``` -------------------------------- ### macholib.dyld.dyld_default_search Source: https://github.com/ronaldoussoren/macholib/blob/master/doc/dyld.md Yields filesystem locations for a dynamic library or framework using the system's default search paths, including ~/Library/Frameworks. ```APIDOC ## macholib.dyld.dyld_default_search(name) ### Description Yield the filesystem locations to look for a dynamic library or framework using the default locations used by the system dynamic linker. This function will look in `~/Library/Frameworks` for frameworks, even though the system dynamic linker doesn’t. The *env* argument is a dictionary, which defaults to `os.environ`. ### Parameters #### Path Parameters - **name** (str) - Required - The name of the dynamic library or framework to search for. #### Query Parameters - **env** (dict) - Optional - A dictionary representing environment variables, defaults to `os.environ`. ``` -------------------------------- ### macholib.dyld.framework_find Source: https://github.com/ronaldoussoren/macholib/blob/master/doc/dyld.md Finds a framework using semantics similar to the system dynamic linker, but accepts looser names. Can resolve inputs like 'Python' or 'Python.framework/Versions/Current'. ```APIDOC ## macholib.dyld.framework_find(fn) ### Description Find a framework using the same semantics as the system dynamic linker, but will accept looser names than the system linker. This function will return a correct result for input values like: * Python * Python.framework * Python.framework/Versions/Current ### Parameters #### Path Parameters - **fn** (str) - Required - The name or path of the framework to find. ``` -------------------------------- ### Convert App Bundles to Standalone Source: https://github.com/ronaldoussoren/macholib/blob/master/doc/scripts.md This command converts application bundles into standalone versions by copying non-system shared libraries and frameworks into the bundle and updating load commands. Ensure the input is a valid application bundle. ```bash python -m macholib standalone appbundle... ``` -------------------------------- ### macholib.dyld.dyld_library_path Source: https://github.com/ronaldoussoren/macholib/blob/master/doc/dyld.md Returns a user-specified library search path, respecting the DYLD_LIBRARY_PATH environment variable. Returns an empty list if only the default search path should be used. ```APIDOC ## macholib.dyld.dyld_library_path() ### Description Returns a user-specified library search path, or an empty list when only the default search path should be used. The *env* argument is a dictionary, which defaults to `os.environ`. See the description of `DYLD_LIBRARY_PATH` in the manual page for dyld(1) for more information. ### Parameters #### Query Parameters - **env** (dict) - Optional - A dictionary representing environment variables, defaults to `os.environ`. ``` -------------------------------- ### macholib.dyld.dyld_find Source: https://github.com/ronaldoussoren/macholib/blob/master/doc/dyld.md Returns the filesystem path of a dynamic library, searching using the same locations as the system dynamic linker. Raises ValueError if the library cannot be found. ```APIDOC ## macholib.dyld.dyld_find(name, executable_path, loader_path=None) ### Description Returns the path of the requested dynamic library, raises `ValueError` when the library cannot be found. This function searches for the library in the same locations and de system dynamic linker. The *executable_path* should be the filesystem path of the executable to which the library is linked (either directly or indirectly). The *env* argument is a dictionary, which defaults to `os.environ`. The *loader_path* argument is an optional filesystem path for the object file (binary of shared library) that references *name*. #### Versionchanged Changed in version 1.6: Added the *loader_path* argument. ### Parameters #### Path Parameters - **name** (str) - Required - The name of the dynamic library to find. - **executable_path** (str) - Required - The filesystem path of the executable linked to the library. - **loader_path** (str) - Optional - The filesystem path of the object file referencing the library. #### Query Parameters - **env** (dict) - Optional - A dictionary representing environment variables, defaults to `os.environ`. ``` -------------------------------- ### macholib.dyld.dyld_override_search Source: https://github.com/ronaldoussoren/macholib/blob/master/doc/dyld.md Yields filesystem paths for a framework relative to the framework search path, or relative to the library search path for other names. Respects environment variables for search paths. ```APIDOC ## macholib.dyld.dyld_override_search(name) ### Description If *name* is a framework name yield filesystem paths relative to the entries in the framework search path. Always yield the filesystem paths relative to the entries in the library search path. The *env* argument is a dictionary, which defaults to `os.environ`. ### Parameters #### Path Parameters - **name** (str) - Required - The name of the framework or library to search for. #### Query Parameters - **env** (dict) - Optional - A dictionary representing environment variables, defaults to `os.environ`. ``` -------------------------------- ### macholib.MachO.MachO Source: https://github.com/ronaldoussoren/macholib/blob/master/doc/MachO.md Creates a MachO object by reading the Mach-O headers from filename. The filename should refer to an existing file in Mach-O format, and can refer to fat (universal) binaries. ```APIDOC ## macholib.MachO.MachO(filename, allow_unknown_load_commands=False) ### Description Creates a MachO object by reading the Mach-O headers from *filename*. The *filename* should refer to an existing file in Mach-O format, and can refer to fat (universal) binaries. When *allow_unknown_load_commands* is false the instance will raise an error when the specified file contains unknown load commands. ### Parameters #### Path Parameters - **filename** (str) - Required - The path to the Mach-O file. - **allow_unknown_load_commands** (bool) - Optional - Defaults to False. If false, an error is raised for unknown load commands. ### Method [Constructor Call] ### Endpoint [N/A] ### Request Example [N/A] ### Response #### Success Response - **Macho object** (object) - An instance of the MachO class representing the Mach-O file. #### Response Example [N/A] ``` -------------------------------- ### Command-line tool usage with python -m macholib Source: https://github.com/ronaldoussoren/macholib/blob/master/doc/changelog.md Use 'python -m macholib' to invoke command-line tools like dump, find, and standalone. This ensures you are using the correct version of the tools. ```default $ python -mmacholib dump /usr/bin/grep ``` ```default $ python -mmacholib find ~ ``` ```default $ python -mmacholib standalone myapp.app ``` -------------------------------- ### Extract framework information Source: https://github.com/ronaldoussoren/macholib/blob/master/doc/framework.md Use framework_info to parse dynamic library names within macOS frameworks. Returns None if the format is not recognized. The returned dictionary contains location, name, shortname, version, and suffix. ```python from macholib.framework import framework_info info = framework_info("Some/Path/My.framework/Versions/A/My") print(info) # Expected output: # { # 'location': 'Some/Path', # 'name': 'My.framework/Versions/A/My', # 'shortname': 'My', # 'version': 'A', # 'suffix': None # } ``` -------------------------------- ### macholib.dyld.dyld_image_suffix_search Source: https://github.com/ronaldoussoren/macholib/blob/master/doc/dyld.md Yields all items from an iterator, prepending the image suffix to names if the suffix is specified via environment variables. ```APIDOC ## macholib.dyld.dyld_image_suffix_search(iterator) ### Description Yields all items in *iterator*, and prepents names with the image suffix to those items when the suffix is specified. The *env* argument is a dictionary, which defaults to `os.environ`. ### Parameters #### Path Parameters - **iterator** (iterable) - Required - An iterable yielding names to process. #### Query Parameters - **env** (dict) - Optional - A dictionary representing environment variables, defaults to `os.environ`. ``` -------------------------------- ### Extract Dynamic Library Information Source: https://github.com/ronaldoussoren/macholib/blob/master/doc/dylib.md Use dylib_info to parse a dynamic library filename and extract its components. Returns None if the filename does not match expected patterns. ```python from macholib.dylib import dylib_info info = dylib_info('Location/Name.SomeVersion_Suffix.dylib') print(info) info = dylib_info('Location/Name.SomeVersion.dylib') print(info) info = dylib_info('Location/Name_Suffix.dylib') print(info) info = dylib_info('Location/Name.dylib') print(info) info = dylib_info('invalid_name.txt') print(info) ``` -------------------------------- ### macholib.dyld.dyld_image_suffix Source: https://github.com/ronaldoussoren/macholib/blob/master/doc/dyld.md Looks up and returns the suffix to append to shared library and framework names, based on the DYLD_IMAGE_SUFFIX environment variable. Returns None if no suffix should be appended. ```APIDOC ## macholib.dyld.dyld_image_suffix() ### Description Looks up the suffix to append to shared library and framework names and returns this value when found. Returns `None` when no suffix should be appended. The *env* argument is a dictionary, which defaults to `os.environ`. See the description of `DYLD_IMAGE_SUFFIX` in the manual page for dyld(1) for more information. ### Parameters #### Query Parameters - **env** (dict) - Optional - A dictionary representing environment variables, defaults to `os.environ`. ``` -------------------------------- ### macholib.MachO.lc_str_value Source: https://github.com/ronaldoussoren/macholib/blob/master/doc/MachO.md Returns the bytes for an lc_str value, given the offset of type lc_str and the cmd_info that contains the structure that contains the lc_str value. cmd_info is and item in the commands attribute of a MachOHeader instance. ```APIDOC ## macholib.MachO.lc_str_value(offset, cmd_info) ### Description Returns the bytes for an `lc_str` value, given the *offset* of type `lc_str` and the `cmd_info` that contains the structure that contains the `lc_str` value. `cmd_info` is and item in the `commands` attribute of a MachOHeader instance. ### Parameters #### Path Parameters - **offset** (int) - Required - The offset of type `lc_str`. - **cmd_info** (object) - Required - The `cmd_info` that contains the structure that contains the `lc_str` value. This is an item in the `commands` attribute of a MachOHeader instance. ### Method [Function Call] ### Endpoint [N/A] ### Request Example [N/A] ### Response #### Success Response - **bytes** (bytes) - The bytes for the `lc_str` value. #### Response Example [N/A] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.