I downloaded and built a C, g++ library that I want to use in a couple of other C projects.

What is the best/standard directory to put the library in on OS X Snow Leopard?

  • /opt/local/lib/
  • /usr/local/lib/
  • any other?

And related: What is the standard library/include search path for g++?

1 Answer 1


/usr/local/lib is the standard place for these in almost any Unix-like OS.

MacPorts creates the /opt hierarchy so that it doesn't mess with what you've done manually in /usr/local/.

Fink creates the /sw hierarchy for similar reasons.

Homebrew I think still defaults to messing with /usr/local (a design decision I find distasteful), but I think it has a "prefix" option to make it use its own hierarchy instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.