Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

486
Views
Cannot install mcrypt with homebrew and php7.4

OS: macOS 11 (big sur)

Homebrew: 2.5.12

PEAR Version: 1.10.12

I just upgraded the php on my mac from php7.1 to php7.4 with homebrew (brew install php@7.4).

Then, when I try to install mcrypt extension, I got the error:

configure: error: mcrypt.h not found. Please reinstall libmcrypt.
ERROR: `/private/tmp/pear/install/mcrypt/configure --with-php-config=/usr/local/homebrew/opt/php@7.4/bin/php-config --with-mcrypt' failed

Here is what I did:

  1. brew isntall mcrypt
  2. install the pecl
  3. sudo pecl install mcrypt -- The error goes here.

What I tried:

  1. Located the mcrypt.h and put manually the file to the several locations (based on the php-config), not work.

  2. Cleaned the brew and reinstall/relink the mcrypt(libmcrypt), not work.

  3. Removed the legacy mcrypt files of the old brew version.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

The problem here is the configure command can't find the libmcrypt installed by homebrew

You can

  1. Download the source code of mcrypt-1.0.4, then cd in the folder

  2. run "phpize"

  3. run "./configure --with-mcrypt=/opt/homebrew/Cellar/mcrypt/2.6.8", you can change the path here with your path for homebrew lib

  4. run "make && make install"

  5. add extension=mcrypt.so to your config file

ps: Use php -i | grep "Loaded Configuration File" to locate your php configure file

over 4 years ago · Santiago Trujillo Report

0

I ran into the same problem. So after installing libmcrypt with brew install mcrypt it seems like configure is not able to resolve the path to mcrypt.h automatically. It also does not work to specify the CPPFLAGS or giving the homebrew include path.

But I found a solution that works for me by giving pecl the install location of mcrypt in the Homebrew Cellar. This is what the following code does automatically:

pecl install mcrypt <<<"$(ls -d $(brew --prefix)/Cellar/mcrypt/* | tail -1)"

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!