You have to build the GMP extension from the PHP source code. First install Autoconf and GMP using Homebrew.
brew install autoconf gmpDownload and unpack PHP.
http://php.net/get/php-7.4.2.tar.bz2/from/a/mirror
$ cd php-7.4.2/ext/gmp
$ /Applications/MAMP/bin/php/php7.4.2/bin/phpize
$ ./configure --with-php-config=/Applications/MAMP/bin/php/php7.4.2/bin/php-config
$ make
$ make installAdd the extension loading config to php.ini in /Applications/MAMP/bin/php/php7.4.2/conf.
extension=gmp.soRestart MAMP servers and verify extension is loaded in the phpinfo() report.
Hi @Stichoza , I have tried to compile with this stuff (mac m1) : ./configure --with-php-config=/Applications/MAMP/bin/php/php8.1.13/bin/php-config CXXFLAGS="-I/opt/homebrew/Cellar/gmp/6.2.1_1/include" CPPFLAGS="-I/opt/homebrew/Cellar/gmp/6.2.1_1/include" LDFLAGS="-L/opt/homebrew/Cellar/gmp/6.2.1_1/lib"