When doing a composer update
in a Craft project on MacOS Catalina, I suddenly get the following error:
***** requires ext-zip * -> the requested PHP extension zip is missing from your system.
Any ideas?
Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. It only takes a minute to sign up.
Sign up to join this communityThe reason seems to be that either the PHP version of the MacOS Catalina update or a version installed via brew do not come bundled with the ext-zip extension.
You can verify that by calling php -m
in the Terminal. You will get a list of all modules and it will not contain the word zip
Even if it contains the word zip
it does not necessarily mean that composer has it available. This is caused by the way ZSH (shell on MacOS) handles the PATH variable.
In my case I used an alias pointing to the MAMP version of PHP (which has zip enabled), but composer was using the PHP version found in the PATH variable.
Solution for me: Since I am using MAMP I modified the PATH in /etc/paths to have the MAMP PHP PATH on the very beginning, e.g.
/Applications/MAMP/bin/php/php7.1.31/bin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
After that change composer update
should work again as expected (make sure you close your Terminal first and do the update in a new Terminal window). Also php -m
should now definitely list the zip extension