title: How to find the default search path for object code libraries on Mac OS X?
body: <p>The man page of <code>dyld</code> (the dynamic link editor) says:<br>
  DYLD_FALLBACK_LIBRARY_PATH ... is a colon separated list of directories that contain libraries.  It is used as the default location for libraries not found in their install path.  By default, it is set to $(HOME)/lib:/usr/local/lib:/lib:/usr/lib.</p>
  
  <p>However, contrary to the man page, DYLD_FALLBACK_LIBRARY_PATH is empty or undefined by default on Mac OS X, as shown by the following bash commands.</p>
  
  <pre><code>printenv DYLD_FALLBACK_LIBRARY_PATH
  # OR
  echo $DYLD_FALLBACK_LIBRARY_PATH
  </code></pre>
  
  <p>In fact, all the environment variables listed and explained on the man page of <code>dyld</code> are empty or undefined, as revealed by the following bash script.</p>
  
  <pre><code>#!/bin/bash
  
  while IFS=$'\n' read -r; do
    printf %b "$REPLY  =  "
    printenv "$REPLY"
    echo
  done &lt; &lt;(cat &lt;&lt; EOF
  DYLD_FRAMEWORK_PATH
  DYLD_FALLBACK_FRAMEWORK_PATH
  DYLD_LIBRARY_PATH
  DYLD_FALLBACK_LIBRARY_PATH
  DYLD_ROOT_PATH
  DYLD_SHARED_REGION
  DYLD_INSERT_LIBRARIES
  DYLD_FORCE_FLAT_NAMESPACE
  DYLD_IMAGE_SUFFIX
  DYLD_PRINT_OPTS
  DYLD_PRINT_ENV
  DYLD_PRINT_LIBRARIES
  DYLD_PRINT_LIBRARIES_POST_LAUNCH
  DYLD_BIND_AT_LAUNCH
  DYLD_NO_FIX_PREBINDING
  DYLD_DISABLE_DOFS
  DYLD_PRINT_APIS
  DYLD_PRINT_BINDINGS
  DYLD_PRINT_INITIALIZERS
  DYLD_PRINT_REBASINGS
  DYLD_PRINT_SEGMENTS
  DYLD_PRINT_STATISTICS
  DYLD_PRINT_DOFS
  DYLD_NO_PIE
  DYLD_SHARED_CACHE_DIR
  DYLD_SHARED_CACHE_DONT_VALIDATE
  EOF
  )
  </code></pre>
  
  <p>Furthermore, while <code>/etc/ld.so.conf</code> is where Linux stores all the directories that are searched by the loader in order to find the libraries, Mac OSX lacks <code>/etc/ld.so.conf</code>.</p>
  
  <p>Then, where does Mac OS X store the default search path for libraries?</p>