
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
mac-dependencies
Advanced tools
A library to check dependencies of a given executable or dylib on Mac OSX
Mac-dependencies is a node.js module to "walk" dependencies of an executable or dylib on Mac. It will automatically resolve the @executable_path, @rpath and @loader_path paths to find dependent libraries.
Users can use it to print the dependencies, check which dependencies were missing, and build a DMG by copying dependent libraries of an executable on Mac (see its usage in GeoDa build toolchain).
print_deps(file_path : String, {options : Dict}) : String
Example:
const macdep = require('mac-dependencies');
macdep.print_deps('/usr/lib/libcurl.dylib');
Output:
└─ ✔ libcurl.dylib /usr/lib/libcurl.dylib
├─ ✔ libcrypto.42.dylib /usr/lib/libcrypto.42.dylib
│ └─ ✔ libSystem.B.dylib /usr/lib/libSystem.B.dylib
├─ ✔ libssl.44.dylib /usr/lib/libssl.44.dylib
│ ├─ ✔ libcrypto.42.dylib /usr/lib/libcrypto.42.dylib
│ │ └─ ✔ libSystem.B.dylib /usr/lib/libSystem.B.dylib
│ └─ ✔ libSystem.B.dylib /usr/lib/libSystem.B.dylib
├─ ✔ libapple_nghttp2.dylib /usr/lib/libapple_nghttp2.dylib
│ └─ ✔ libSystem.B.dylib /usr/lib/libSystem.B.dylib
├─ ✔ libz.1.dylib /usr/lib/libz.1.dylib
│ └─ ✔ libSystem.B.dylib /usr/lib/libSystem.B.dylib
└─ ✔ libSystem.B.dylib /usr/lib/libSystem.B.dylib
Any missing dependencies will be highlighed in the output with a "question mark" icon ❓.
Example:
macdep.print_deps('/Users/xun/test.dylib');
Output:
└─ ✔ test.dylib /Users/xun/test.dylib
├─ ❓ libpng16.16.dylib @rpath/libpng16.16.dylib
└─ ✔ libSystem.B.dylib /usr/lib/libSystem.B.dylib
search_dirsFor missing dependencies, one can specify a list of search dirs as an option to tell the program to search any missing dependencies.
Example:
var opts = {"search_dirs" : ["/usr/lib", "/usr/local/lib"]};
macdep.print_deps('/Users/xun/test.dylib', opts);
Output:
└─ ✔ test.dylib /Users/xun/test.dylib
├─ ✔ libpng16.16.dylib /usr/local/lib/libpng16.16.dylib
└─ ✔ libSystem.B.dylib /usr/lib/libSystem.B.dylib
system_dirsDefault value: ['/usr/lib/system', '/Library/System']
One can specify a list of system dirs as an option to tell the program to ignore when searching dependencies.
Example:
var opts = {
"system_dirs" : ["/usr/lib"],
"search_dirs" : ["/usr/lib", "/usr/local/lib"]
};
macdep.print_deps('/Users/xun/test.dylib', opts);
Output:
└─ ✔ test.dylib /Users/xun/test.dylib
└─ ✔ libpng16.16.dylib /usr/local/lib/libpng16.16.dylib
get_deps(file_path : String, {options : dict}) : object
Example:
const macdep = require('mac-dependencies');
var dep = macdep.get_deps('/usr/lib/libcurl.dylib');
Returns a javascript object representing the tree structure of dependencies. For example:
dep {
// attributes
this.file_path = '/Users/xun/test.dylib', //
this.file_name = 'test.lib', //
this.is_system = false, //
this.is_valid = true, //
this.dependencies = ['/usr/local/lib/libpng16.16.dylib', // a list of dependencies as dep objects
'/usr/lib/libSystem.B.dylib'],
this.executable_path = '/Users/xun',
this.loader_path = '/Users/xun',
this.r_path = undefined
}
One can traverse this tree structure starting from the return object by get_deps() function, and looping its children in dependencies[].
Xun Li lixun at gmail.com
FAQs
A library to check dependencies of a given executable or dylib on Mac OSX
We found that mac-dependencies demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.