Search code examples
macoslaravelmcrypt

How to install mcrypt extension on mac os x yosemite (10.10)


I've updated my Mac OS X to Yosemite, but doing that I over write all my dev environment. So now, to run Laravel 4 on my local apache I need to install the Mcrypt extension, but everything that i've tried i fail. Even the steps that have worked on OS X Mavericks (10.9)

Anybody has the same issue? Thanks in advance.

Cheers


Solution

  • I just installed it right now on my Mavericks installation using homebrew and it worked surprisingly well. Can't say whether or not it will work so well on Yosemite but worth a shot..

    Homebrew

    brew install autoconf
    brew install mcrypt
    

    Macports

    1. Check PHP version

      php -v
      
    2. Update Macports

      sudo port -v selfupdate
      
    3. Download & install the appropriate version..

      sudo port install php55-mcrypt
      

      now dummy proof it..

    4. Find where Macports put the file mcrypt.so and copy it to all instances of /php/extensions/no-debug-... folder. If you have that directory structure in multiple places, copy it to all of them. So every php/extensions/no-debug.. folder on your computer has a copy of mcrypt.so

      sudo cp /opt/local/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so /usr/lib/php/extensions/no-debug-non-zts-20090626/
      
    5. Determine where your php.ini file is and make sure it's the one your actually using because you may have this file in more than 1 place. Do this to all php.ini files you find..

      Within that file find and uncomment the following line. If it's commented out, uncomment it. If it's not in the file at all, add it. In my default php.ini file I found this on line 536:

      extension=mcrypt.so
      

    Compile

    1. Download mcrypt

      curl -O http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
      
    2. Uncompress it

      tar -zxvf libmcrypt-2.5.8.tar.gz
      
    3. Configure, build, and install

      ./configure && make && sudo make install
      
    4. Download Autoconf

      curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
      
    5. Uncompress it

      tar xvfz autoconf-latest.tar.gz
      
    6. Configure, build, and install

      ./configure && make && sudo make install
      

    Apache

    Regardless which method you used to install it. You should always restart Apache when your done.

    1. Restart Apache

      sudo apachectl restart