I want to report a solution to an error I got while installing OpenFOAM 3.0.1 in Mac OS X El Capitan Version 10.11.2 The error was: "error: member reference type 'std::istream *' (aka 'basic_istream *') is a pointer; maybe you meant to use '->'? yyin.rdbuf(std::cin.rdbuf());"
This problem is related to flex version 2.6.0. which I installed using macports.
I could overcome the problem by using "flex 2.5.35 Apple(flex-31)" which is at /usr/bin/flex (instead of /opt/local/flex).
Just change "flex" to "/usr/bin/flex" in the file $(WM_DIR)/rules/General/flex++ of your openfoam source distribution.