lsbom - macOS
Overview
The lsbom command is a powerful tool used to inspect and analyze the contents of binary executables on macOS. It can provide valuable insights into the dependencies, frameworks, and libraries used by a specific application. It is particularly useful for diagnosing issues, ensuring compatibility, or analyzing potential security risks.
Syntax
lsbom [options] [--] <path/to/executable>
Options/Flags
-a,--all: List all dependencies, including transitive dependencies.-f,--full: Provide a verbose output with detailed information about each dependency.-json: Output the results in JSON format.-l,--libraries: List only dependent libraries.-m,--frameworks: List only dependent frameworks.-p,--paths: Print the full paths to dependent files.-s,--summary: Display a concise summary of the dependencies.-t,--tree: Display the dependency tree in a hierarchical format.-x,--exclude: Exclude specific dependencies from the analysis.
Examples
Simple Usage
lsbom /Applications/Safari.app/Contents/MacOS/Safari
Verbose Output with Full Paths
lsbom -f -p /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder
JSON Output
lsbom -json /usr/bin/ls
Dependency Tree
lsbom -t /usr/bin/top
Common Issues
- ErrPermissionDenied: Ensure you have sufficient permissions to access the target executable. Try running the command with 
sudo. - ErrFileNotExist: The specified path may be incorrect or the file may not exist. Verify the path and try again.
 
Integration
lsbom can be combined with other commands for advanced tasks:
xcrun lsbomto analyze executables built with Xcode.lsbom - | grepto filter the results for specific dependencies.lsbom - | jqto process the JSON output using thejqcommand-line JSON processor.
Related Commands
otool: Display information about object files and shared libraries.dependencies: List dependencies of a specific application bundle.