So you’ve updated your macOS to Sierra and you’re just
php artisan serving your Laravel project and out of the blue you read from deep within your memories an uncomfortable wake-up call:
The well-known „Mcrypt PHP extension required“ error message awaits us.
There are different ways of approaching this. The problem is that your project requires the mcrypt library for internal uses and unfortunately doesn’t have it linked. It’s quite common to use your development environment’s PHP build, which you can individually configure to your needs – in this case we will be using MAMP as an example. You could start by finding out the current PHP version – execute
Seems like I’m using version
5.6.25, which is the integrated PHP build that comes with macOS Sierra and doesn’t have the mcrypt extension linked. We can confirm that by typing below command and getting an empty result:
First, select your preferred version from the MAMP control panel. Go to
Preferences > PHP:
Then, we are going to link the
php command to the current build of the MAMP development environment by writing the following source lines to your profile (
You might need to manually source your profile:
And that’s that ! If you now type
php -v, you can see the updated PHP version you just linked. Now
php artisan serving your Laravel should work just fine – or at least not throw the Mcrypt requirement error anymore.
Hopefully this read helped you ! 🚴