0

Apple keeps frameworks in /System/Library/Frameworks/ and /System/Library/PrivateFrameworks/. Inside these directories are *.framework files, which are themselves a directory of computing resources (binary executables, dynamically linked libaries, headers, etc.).

How can I list which frameworks are being currently used by the system, e.g. have a component loaded in kernel memory or are being executed? Is there a way to understand what frameworks are required for a given program, such as a daemon or app, to run properly? If possible I'd like to generate a framework dependency tree for an arbitrarily chosen system program.

I have tried to gather this information from top but this doesn't tell me about dynamically loaded libraries, nor does it explicitly tie an executable to the framework directory from which it comes.

1
  • 2
    Why are you trying to do this? For an app run otool on the executable to show most of what it loads and then rerun on thos libraries
    – mmmmmm
    Feb 17, 2022 at 21:02

1 Answer 1

2

You should note that frameworks can also be placed in really any other place in the file system - they're not constrained to those two paths. In particular, some applications will have frameworks inside their application bundle.

Your first question comes from a misunderstanding - frameworks are not something that are used by the kernel, loaded into kernel memory, and so on. I think you're confusing them with kernel extensions (similar to for example kernel modules in Linux) - which are executables loaded into kernel memory and used by the kernel itself.

Frameworks are instead used by user-space programs, and they are linked into the memory space of that particular user-space program. This can be done in two ways - either it is done on startup by the system's dynamic linker (dyld), or it can be done at run-time by the program itself.

For the first case, you can view the list of frameworks an executable requests the system's dynamic linker to load for it on startup, by running a command like this in the Terminal:

otool -L /Applications/Firefox.app/Contents/MacOS/firefox

For the second case, you will have to monitor the program during execution. Note that you cannot be sure that you'll catch all frameworks used in this manner, as the actual frameworks loaded might depend on the input to the program. It is not usual for programs to work like that though, so you'll probably be fine with using otool for your scenario.

Note that a framework might in itself depend on another framework, so you'll have to rerun otool on the listed frameworks in order to manually build up a dependency graph.

2
  • Thank you for your response! Re kexts I wasn't sure if a framework could contain a kext, e.g. if a framework came with a device driver kext and a user-space library to make calls from it. But using otool to get startup frameworks should be sufficient for me.
    – Chris
    Feb 18, 2022 at 16:15
  • No, frameworks cannot as such contain a kext (I.e. nothing stops you from putting whatever files you want in there, but nothing will load that kext for you).
    – jksoegaard
    Feb 18, 2022 at 19:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .