Software⏱️ 4 min read📅 2026-06-11

How to Fix: Mongodb PHP Driver MacOS Unsigned package error

Error fixing MongoDB PHP Driver MacOS Unsigned package error

Quick Answer: To fix the issue, you can use a tool like Homebrew to install the MongoDB driver with signing enabled.

The MongoDB PHP Driver installation error on macOS can be frustrating, especially when it occurs after enabling 'csrutil' and rebooting. This issue affects users who have installed the driver using PECL and are experiencing difficulties in loading the extension due to an unsigned package.

This problem is particularly vexing because it requires the user to disable 'csrutil' every time they want to run the PHP script, which can be inconvenient and may pose security risks. In this guide, we will walk you through the steps to resolve this issue without having to disable 'csrutil'.

💡 Why You Are Getting This Error

  • The primary reason for this error is that the MongoDB PHP Driver package was not signed with a valid code signature. The driver relies on the Xcode tools to generate and verify the code signatures, which is why enabling 'csrutil' is required. When you disable 'csrutil', the package cannot be verified, resulting in the unsigned package error.
  • Another possible reason for this issue could be due to the outdated version of PHP or the MongoDB Driver package. If your PHP version is not compatible with the driver package, it may cause issues during installation.

✅ Best Solutions to Fix It

Enabling Code Signing for PECL Packages

  1. Step 1: Open the Terminal app and run the command `sudo xcode-select -r` to reset the Xcode tools to their default settings.
  2. Step 2: Next, run the command `sudo security defaults show /usr/lib/php/20160303/mongodb` to check if the code signature is valid. If it's not valid, proceed with the next steps.
  3. Step 3: Run the command `sudo codesign -f -s -d -r --verify /usr/lib/php/20160303/mongodb` to verify and validate the code signature. This may take a few minutes to complete.
  4. Step 4: Once the verification is successful, run the command `sudo pecl install mongdodb` again to reinstall the MongoDB PHP Driver package.

Installing MongoDB PHP Driver using Homebrew

  1. Step 1: Open the Terminal app and run the command `brew install mongodb-driver-php` to install the MongoDB PHP Driver package using Homebrew. This method bypasses the need for code signing.
  2. Step 2: Once the installation is complete, run the command `sudo pecl install mongdodb` again to reinstall the MongoDB PHP Driver package.

✨ Wrapping Up

By following these steps, you should be able to resolve the unsigned package error and load the MongoDB PHP Driver without having to disable 'csrutil'. Remember to regularly update your PHP version and PECL packages to ensure compatibility with the latest drivers. If you encounter any further issues, consider reaching out to the MongoDB community or seeking assistance from a system administrator.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions