MacOS — the requested PHP extension gmp is missing from your system.

--

The problem

I don’t know why but php on my mac after a restart is missing the GMP e(GNU Multiple Precision) extension.

So when i trying to use composer to install/update depedencies i get the following error.

- web-token/jwt-core v1.3.7 requires ext-gmp * -> the requested PHP extension gmp is missing from your system.- web-token/jwt-core v1.3.7 requires ext-gmp * -> the requested PHP extension gmp is missing from your system.- Installation request for web-token/jwt-core (locked at v1.3.7) -> satisfiable by web-token/jwt-core[v1.3.7].

The solution

There is an easy way to solve this.

(I guess you have already installed php via homebrew — more info please find https://medium.com/better-programming/how-to-install-a-php-7-2-on-macos-10-15-catalina-using-homebrew-and-pecl-ad5b6c9ffb17 )

Open terminal and check your php version.

php -v

And from the response check if you have PHP 7.1, 7.2, 7.3 etc
Let’s assume we have 7.3 (please change according your php version)

brew reinstall php@7.3
export PATH="/usr/local/opt/php@7.3/bin:$PATH"
brew services restart php@7.3
php -info | grep "GMP"

If you see the GMP version , you are good to go!

--

--

Dimitris Moutsatsos

developer and weirdo / current: FinTech Insights / Tychetech / Resitech