PostgreSQL CREATE EXTENSION file not found error on Mac OS On PostgreSQL 9.2.3 when trying this:

CREATE EXTENSION btree_gist;


I get this error:


  ERROR: could not open extension control file "/opt/local/share/postgresql92/extension/btree_gist.control": No such file or directory


Running SELECT pg_available_extensions(); shows that indeed is not available.
The problem is that the needed contrib files are not installed. This was actually the case for several contrib modules.

I found help with the solution to this here:
https://wiki-bsse.ethz.ch/display/ITDOC/Get+PostgreSQL+contrib+modules+on+Mac+OS+X

$ su
# port build postgresql92
# cd `port work postgresql92`/postgresql-&lt;version&gt;/contrib
# for d in *; do test -d $d &amp;&amp; ( echo $d; cd $d; make all &amp;&amp; make install; cd .. ); done


I suspect reinstalling everything would work too, but this highlights the actual problem.