3

I am trying to install mcrypt for use on my local machines dev environment. I need to this to install Magento.

I used this answer to install mcrypt, but get the following error:

$ brew link mcrypt
Linking /usr/local/Cellar/mcrypt/2.5.8... Warning: Could not link mcrypt. Unlinking...

Error: Could not symlink file: /usr/local/Cellar/mcrypt/2.5.8/include/mutils/mcrypt.h
Target /usr/local/include/mutils/mcrypt.h already exists. You may need to delete it.
To force the link and delete this file, do:
  brew link --overwrite formula_name

To list all files that would be deleted:
  brew link --overwrite --dry-run formula_name

Trying to overwrite the links as suggested in not allowed.

$ brew link --overwrite mcrypt
Linking /usr/local/Cellar/mcrypt/2.5.8... Warning: Could not link mcrypt. Unlinking...

Error: Permission denied - /usr/local/include/mutils/mcrypt.h

Prepending this command with "sudo" does not fix this issue as that is also not allowed.

Running php -m doesn't show mcrypt as an installed module, and also throws the following error:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20100525/mcrypt.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20100525/mcrypt.so, 9): image not found in Unknown on line 0 

This all seems to be related to the fact that I cannot link this, I just can't seem to solve this issue though. Has anyone encountered this? Thanks for any help you can provide.

Community
  • 1
  • 1
Thomas
  • 2,426
  • 3
  • 23
  • 38

2 Answers2

3

Thomas, from what I can see above it looks like you're trying to use Homebrew to install the mcrypt package to your system, but mcrypt has already been installed by another package management system (or may ship by default in your version of OS X — I don't keep up on these things)

Since mcrypt is already installed on your *nix system, what you need to do is install the PHP extension for mycrypt, or install a version of PHP that support mcrypt out of the box.

My usual approch to this is to use the hp-osx.liip.ch package (which seems to be the successor to Marc Liyanage's old entropy.ch package). This installs a stand alone version of PHP as a binary, and should have the libraries you need to run Magento.

Alana Storm
  • 164,128
  • 91
  • 395
  • 599
  • I was under the impression that `brew install mcrypt php53-mcrypt` installed the php extension - do you know if this is correct? If that is correct than I already have the extension installed and just need to link, but have been unable to do so. – Thomas Apr 12 '13 at 20:27
  • @thomas I'm more a `ports` person, and this stuff is an endless cascade of permutations, but hopefully this helps: The command `brew install mcrypt` installs `mycrypt`. The command `brew install php53-mcrypt` installs PHP 5.3 with the mycrypt extension. The command `brew install mcrypt php53-mcrypt` installs `mcrypt`, and then installs PHP 5.3 with the mcrypt extension. Homebrew won't create the symlink to mcrypt because **there's already an mcrypt** in /usr/local from something else. Having homebrew blow this away would probably be a bad idea. It sounds like all you need is PHP with mcrypt. – Alana Storm Apr 12 '13 at 20:57
  • @Thomas your getting the PHP error because its failing to load the extension :) I had the same problem. If you run the locate command. E.g. locate mcrypt.so it will show where it is located. Then presuming you are using the stock PHP edit /etc/php.ini find the mcrypt line and replace the paths. Failing that on my Mac I run vagrant with a true LAMP stack for magento development and it works alot better. – James Cowie Apr 12 '13 at 21:13
3

I actually just ran into this problem for the second time. Couldn't remember how I solved it the first time. What worked for me this time was I actually deleted the mcrypt.h file under mutils. Then when I ran brew link --overwrite mcrypt it successfully linked. Then I ran brew install php53-mcrypt and that seemed to do the trick. Also restart the server.

Wouldn't be surprised if this doesn't work for everyone but it worked for me.

Jeffery Mills
  • 189
  • 12