No, there's no direct way to do this. You can use
chflags hidden to hide things from the Finder, but that doesn't affect the command-line.
The solution would depend on the configure script. It may simply look along
PATH to notice the
/usr/local, but more likely it will have a hardcoded list of directories to look at — including
/usr/local. To work around the former (
PATH-based), you could adjust your path. For the latter, the only thing that works is to modify the
The reason why you'll see hardcoded lists is that add-ons may not use the same search paths as the rest of the system. For instance, the various BSD ports may use
/usr/local, etc., and partly rely upon the packagers to set these pathnames in their build-scripts. But programs that are not built as part of the ports system have to look for things in those places, to build with little user attention.
If you want to override the default search path for OSX, start with the
ld manual page, which says
ld maintains a list of directories to search for a library or framework
to use. The default library search path is
-L option will add a new library search path. The default framework
search path is
/Network/Library/Frameworks was at the end of the
default path. If you need that functionality, you need to explicitly add
-F option will add a new framework
search path. The
-Z option will remove the standard search paths. The
-syslibroot option will prepend a prefix to all search paths.
and you can pass options to
ld by prefixing them with
-Wl (and using a comma where a space is needed). For your purpose, you would write a script which
-Z to remove the search paths, and
- add back the parts you need using
-v shows the details of the compiler front-end, and passing
ld, e.g., using
-Wl,-v shows the linker's details.
Something like this, for example:
clang -Wl,-Z -L/usr/lib -F/Library/Frameworks -F/System/Library/Frameworks "$@"
It is not documented in the
clang manual, but a quick check shows that it would pass a plain
-Z option to the linker. On the other hand,
clang does document options (mainly for gcc-compatibility) which suppress its searches of different categories of include-directories:
Do not search the standard system directories or compiler
builtin directories for include files.
Do not search the standard system directories for include files,
but do search compiler builtin include directories.
Do not search clang's builtin directory for include files.
It does not have an option for showing the search-path for include files, but you can infer that by running the preprocessor.
Once you've gotten the script working, then running the
configure script, you would set
CC to that script's name, e.g.,
I've been doing this a while, but haven't needed this particular combination (see Compiler wrappers).