JoshJohnsonUK
JoshJohnsonUK

Reputation: 55

MCrypt is missing from your system. OS Yosemite

So at work, I've been tasked to learn and start to use some Laravel, so I've been following the documentation and some tutorials on Youtube, but I cannot seem to get it working. I am using composer and MAMP to install Laravel. When I use the command (in the terminal) "composer create-project laravel/laravel TestLaravel" while in htdocs. It quickly comes up with this error:

➜  htdocs  composer create-project laravel/laravel TestLaravel
Installing laravel/laravel (v5.0.1)
  - Installing laravel/laravel (v5.0.1)
    Loading from cache

Created project in TestLaravel
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/framework v5.0.5 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.4 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.3 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.2 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.1 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.0 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - Installation request for laravel/framework 5.0.* -> satisfiable by laravel/framework[v5.0.0, v5.0.1, v5.0.2, v5.0.3, v5.0.4, v5.0.5].

I was wondering if anyone would have a solution to this problem for me.

Thank you.

Joshua Johnson

Upvotes: 1

Views: 13245

Answers (4)

code-8
code-8

Reputation: 58770

Mac OS X Yosemite

the requested PHP extension mcrypt is missing from your system

I fixed this error by running the following commands in my Terminal :

brew update
brew upgrade
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
brew install php54-mcrypt

Upvotes: 6

Mandeep Gill
Mandeep Gill

Reputation: 4907

Mostly this problem comes when your MAMP PHP Version not match with command version php. Please have a look in terminal by type php -v then it will show version like php 5.5.*

The problem is you have to set your MAMP PHP Path in ~/.bash_profile like this :

sudo nano ~/.bash_profile

PATH="/Applications/MAMP/bin/php/php5.6.7/bin:$PATH"

That's all, or install mcrypt lib if you want to use your default system php.

Upvotes: 3

Alana Storm
Alana Storm

Reputation: 166156

There's a PHP extension named mcrypt that's often not distributed with stock PHP packages. The mcrypt extension is the defacto standard PHP extension for encryption and hashing functionality. Laravel uses mcrypt.

The built in PHP on OS X does not come with mcrypt installed. This means you either need to

  1. Build and install the mcrypt extension yourself for OS X's built in PHP
  2. Use homebrew to build and install PHP with mycrypt
  3. Use a "pre-compiled for OS X" PHP package.
  4. Use a vagrant virtual machine to run your development stack

I usually chose the third option, and use the lipp.ch package. This is a long running project, and has it's roots in the old entropy.ch packages managed by Marc Liyanage from even further back.

Upvotes: 0

Jesse Schutt
Jesse Schutt

Reputation: 396

The way that I got around this was to install Homestead and make sure to log in to the Homestead Virtual Machine before running any commands. MCrypt is not installed on your local machine, but it is in Homestead.

Upvotes: 2

Related Questions