Errors Installing Composer on macOS (JIT compilation Failed)

  • A+
Category:Languages

When I run composer --version in the macOS terminal I get the following errors:

PHP Warning: preg_match(): JIT compilation failed: no more memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php on line 755

Warning: preg_match(): JIT compilation failed: no more memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php on line 755 PHP Warning:  preg_match(): JIT compilation failed: no more memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php on line 759  Warning: preg_match(): JIT compilation failed: no more memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php on line 759 PHP Warning:  preg_split(): JIT compilation failed: no more memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php on line 654  Warning: preg_split(): JIT compilation failed: no more memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php on line 654 PHP Warning:  preg_split(): JIT compilation failed: no more memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php on line 1091  Warning: preg_split(): JIT compilation failed: no more memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php on line 1091 PHP Warning:  preg_replace(): JIT compilation failed: no more memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Formatter/OutputFormatter.php on line 36  Warning: preg_replace(): JIT compilation failed: no more memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Formatter/OutputFormatter.php on line 36    [ErrorException]                                             preg_match_all(): JIT compilation failed: no more memory 

 


I solved this by disabling the PCRE jit compilation.

I suppose you installed php 7.3 through homebrew.

If so, create a zzz-myphp.ini in /usr/local/etc/php/7.3/conf.d with the following content:

; My php.ini settings ; Fix for PCRE "JIT compilation failed" error [Pcre] pcre.jit=0 

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: