Installing ext-zip on macOS: The Catalina Reality Check
Running composer update on a Mac recently upgraded to Catalina (or later) often throws a hard stop if the ext-zip PHP extension is missing. This isn't a Composer bug, nor is it an issue with your composer.json. The error message is explicit: Problem 1 - The requested PHP extension ext-zip * is missing from your system.
Many developers instinctively try to solve this by adding "ext-zip": "*" to the require section of their project's composer.json. This approach fails because Composer manages application dependencies (libraries), not low-level C extensions compiled into the PHP runtime. The extension must be installed at the system or global PHP level before Composer can even attempt to resolve your dependencies.
Why macOS Catalina Changed the Game
The root cause here is a deliberate architectural shift in Apple's operating system. Prior to Catalina, Macs shipped with a unified Xcode command-line tools environment that included older versions of PHP and its extensions. When you updated macOS to Catalina (10.15) or beyond, Apple deprecated the legacy Xcode toolchain for general development tasks and moved toward using Homebrew-managed packages to ensure consistency across different OS versions.
The bundled PHP in macOS Catalina is a minimal installation designed strictly for system services like Mail and Safari. It does not include ext-zip, which is essential for libraries like phpoffice/phpspreadsheet (which powers the popular maatwebsite/excel package). Without this extension, your application cannot unzip uploaded files or process Excel sheets, causing Composer to fail immediately upon encountering a dependency that requires it.
The Solution: Installing via Homebrew
The standard and most reliable way to install missing PHP extensions on modern macOS is using Homebrew. Since you have already upgraded to Catalina, you should be using the Homebrew version of PHP rather than trying to patch the system files or installing from Xcode.
First, ensure you are using a compatible version of Homebrew that supports your current OS version. Then, install the php package and specifically request the zip extension:
brew install php@7.4 --with-openssl --with-zip
Note the --with-zip flag. While some PHP packages include extensions by default, explicitly requesting zip ensures it is compiled in. If you are unsure which PHP version you need, check your current setup with php -v. You might prefer to use a specific minor version like 7.4 or 8.0 depending on your project requirements:
brew install php@7.4 --with-zip
# Or for PHP 8.x
brew install php@8.0 --with-zip
Once the package is installed, you must verify that Composer sees the new installation. If your system is using the built-in macOS PHP (which lacks the extension), you need to ensure composer is pointing to the Homebrew version. You can do this by checking where php is located:
which php
# Should return something like /usr/local/bin/php or /opt/homebrew/bin/php
If which php points to /usr/bin/php, you likely need to update your PATH environment variable so that Homebrew's PHP takes precedence. Add the following to your shell profile file (e.g., .zshrc or .bash_profile):
export PATH="/usr/local/bin:$PATH"
# Or for Apple Silicon Macs with M1/M2 chips:
export PATH="/opt/homebrew/bin:$PATH"
After reloading your terminal session, run php -m to confirm that zip is now listed in the loaded modules.
What About composer require ext-zip?
It is a common misconception that you can install extensions via Composer commands. Running composer require ext-zip will not work because the package does not exist in Packagist as a standalone dependency that Composer can fetch from the internet. The extension must be compiled against the PHP binary at build time or installed globally via the package manager (Homebrew, PECL, or apt on Linux).
If you are still stuck after installing the extension, ensure your composer.json
