天天看点

Locations for Public Frameworks

Third-party frameworks can go in a number of different file-system locations, depending on certain factors.

Most public frameworks should be installed at the local level in <code>/Library/Frameworks</code>.

If your framework should only be used by a single user, you can install it in the <code>~/Library/Frameworks</code> subdirectory of the current user; however, this option should be avoided if possible.

If they are to be used across a local area network, they can be installed in  <code>/Network/Library/Frameworks</code>; however, this option should be avoided if possible. 

For nearly all cases, installing your frameworks in <code>/Library/Frameworks</code> is the best choice. Frameworks in this location are discovered automatically by the compiler at compile time and the dynamic linker at runtime. Applications that link to frameworks in other directories, such as <code>~/Library/Frameworks</code> or <code>/Network/Library/Frameworks</code>, must specify the exact path to the framework at build time so that the dynamic linker can find it. If the path changes (as it might for a user home directory), the dynamic linker may be unable to find the framework.

Another reason to avoid installing frameworks in <code>~/Library/Frameworks</code> or <code>/Network/Library/Frameworks</code> is the potential performance penalties. Frameworks installed in network directories or in network-based user home directories can cause significant delays in compilation times. Loading the framework across the network can also slow down the launch of the target application.

Third-party frameworks should never be installed in the <code>/System/Library/Frameworks</code> directory. Access to this directory is restricted and is reserved for Apple-provided frameworks only.

When you build an application or other executable, the compiler looks for frameworks in<code>/System/Library/Frameworks</code> as well as any other location specified to the compiler. The compiler writes path information for any required frameworks in the executable file itself, along with version information for each framework. When the application is run, the dynamic link editor tries to find a suitable version of each framework using the paths in the executable file. If it cannot find a suitable framework in the specified location (perhaps because it was moved or deleted), it looks for frameworks in the following locations, in this order:

The explicit path to the framework that was specified at link time.

The <code>/Library/Frameworks</code> directory.

The <code>/System/Library/Frameworks</code> directory.

If the dynamic link editor cannot locate a required framework, it generates a link edit error, which terminates the application. 

https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/InstallingFrameworks.html#//apple_ref/doc/uid/20002261-BBCCFBJA

------------------越是喧嚣的世界,越需要宁静的思考------------------

合抱之木,生于毫末;九层之台,起于垒土;千里之行,始于足下。

积土成山,风雨兴焉;积水成渊,蛟龙生焉;积善成德,而神明自得,圣心备焉。故不积跬步,无以至千里;不积小流,无以成江海。骐骥一跃,不能十步;驽马十驾,功在不舍。锲而舍之,朽木不折;锲而不舍,金石可镂。蚓无爪牙之利,筋骨之强,上食埃土,下饮黄泉,用心一也。蟹六跪而二螯,非蛇鳝之穴无可寄托者,用心躁也。