'fatal error: 'geos_c.h' file not found on Mac m1

I have already installed geos library using brew install geos, but I'm still getting following error on mac M1.

./geos.h:1:10: fatal error: 'geos_c.h' file not found
#include <geos_c.h>
         ^~~~~~~~~~
1 error generated.



Solution 1:[1]

I believe it is because brew doesn't install the header packages. You can build from source. This is what I did to solve it:

brew install wget

wget http://download.osgeo.org/geos/geos-3.3.8.tar.bz2

tar -xvf geos-3.3.8.tar.bz2

And run ./configure, make, and sudo make install in the extracted directory.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 arviman