On mac, g++ (clang) fails to search /usr/local/include and /usr/local/lib by default

I also use Homebrew and had a similar problem on Mac OSX Maverick 10.9.5 and Xcode 6.0.1, but it was solved by running:

xcode-select --install

Note that it doesn’t work without the double hyphens given by the previous answer. This installs the command-line tools that also create /usr/lib/ and /usr/include/. I don’t know why Homebrew doesn’t automatically check this upon installation, since it does check for Xcode…

If you want to check exactly what folders your compiler is looking through for header files you can write:

cpp -v

Leave a Comment