Use of -headerpad_max_install_names for OS X

Use of -headerpad_max_install_names for OS X

Is it possible to work into the Makefiles for OS X to include -headerpad_max_install_names as a linker command? This would allow end developers to change the "install_name" of the libraries to their installation location. This saves having to add in environment variables such as "DYLD_LIBRARY_PATH" because the end developer can set path to what they want. Just to be clear just by adding the linker argument gives the end developer the option of changing the "install_name" if they want, the actual "install_name" is still set to just the name of the library. This change should in no way break any existing builds but adds the flexibility for developers like myself to set the install_name if needed.


Use Case:
  I use a shell script to bundle my final application and part of the shell script runs "otool" on each of the dependent libraries in order to find them and bring them into the .app bundle. Also during development I do NOT need to setup the DYLD_LIBRARY_PATH because the path to the library is encoded in the library itself. This makes working with IDEs such as QtCreator and Eclipse and Xcode easier.

Thanks for your Consideration.

Mike Jackson


3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

we will look at what this means(:)) and get back to you.

but from your decription option would be useful.

thanks, Vladimir

I was going to post some more information when I came across this post:

Which also states the same problem but in a different way. That user would like you to set the "install_name" directly which I agree is not a good idea. By setting the "-headerpad_max_install_names" linker argument you allow the developer to set the install_name to what ever they want. (Within reasonable limits of the file system).

This is the shell script I use to adjust the install_name



# This script updates the Intel Threading Building Blocks on OS X to have an install name
# that is the same directory to where it is installed

# The first argument is the install path to TBB, for example on this machine it
# located in "/Users/Shared/Toolkits/tbb40_20120408oss"

cd "$tbbInstallDir/lib"

tbbLibs="libtbb.dylib libtbbmalloc.dylib libtbb_debug.dylib libtbbmalloc_debug.dylib"

for l in $tbbLibs;
  install_name_tool -id $tbbInstallDir/lib/$l $l



The issue is that without the "-headerpad_max_install_names" parameter set during link time the script will fail 99% of the time. This is preventing me from moving up to the latest TBB release without building it myself. If I build it myself then I get incomplete builds, or the builds just do not work under the latest Xcode.



Mike Jackson

Leave a Comment

Please sign in to add a comment. Not a member? Join today