install GNU m4 1.4 or later on OSX

Old question but i try to give new related solution

I run :

phpize

then got

autom4te: need GNU m4 1.4 or later: /Applications/MAMP/Library/bin/m4

because /Applications/MAMP/bin/php/php7.2.8/bin/phpize always try to use it own /Applications/MAMP/Library/bin/m4

Solve problem by:

  • brew install m4

brew installed m4 to /usr/local/opt/m4

  • mv /Applications/MAMP/Library/bin/m4 /Applications/MAMP/Library/bin/m4_backup
  • ln -s /usr/local/opt/m4/bin/m4 /Applications/MAMP/Library/bin/m4
  • phpize
  • unlink /Applications/MAMP/Library/bin/m4
  • mv /Applications/MAMP/Library/bin/m4_backup /Applications/MAMP/Library/bin/m4

hope this will help wrong m4 bin problem


The solution was to install the "Command Line Tools" from within Xcode. ⌘, opens preferences and the install button for the "Command Line Tools" can be found in the "Downloads."


On the other hand, if you have homebrew installed already, you can still look for m4 in other places. I just tried running "brew install m4" and it returns "homebrew/dupes/m4". So I run "sudo brew install homebrew/dupes/m4" instead. Now it installed m4 1.4.17 to my computer from gnu.