Skip to content

Instantly share code, notes, and snippets.

@theaungmyatmoe
Last active September 4, 2023 09:23
Show Gist options
  • Save theaungmyatmoe/92a26948740502289e51f043e1be2c5c to your computer and use it in GitHub Desktop.
Save theaungmyatmoe/92a26948740502289e51f043e1be2c5c to your computer and use it in GitHub Desktop.
Installing mongodb pecl extension in MacOS

mongodb

Install phpize

brew install autoconf

and then export like following if the autoconf is not working.

export PHP_AUTOCONF=/usr/local/bin/autoconf

or you can also read more here.

When you failed like this.

c/mongoc/mongoc-scram.lo  -fno-common -DPIC -o src/libmongoc/src/libmongoc/src/mongoc/.libs/mongoc-scram.o
/private/var/tmp/pear/temp/mongodb/src/libmongoc/src/libmongoc/src/mongoc/mongoc-scram.c:85:10: fatal error: 'unicode/usprep.h' file not found
#include <unicode/usprep.h>
         ^~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [src/libmongoc/src/libmongoc/src/mongoc/mongoc-scram.lo] Error 1
ERROR: `make' failed

Conduct to this thread

Install Unicode Libaray

brew reinstall icu4c
brew link icu4c --force

And then configure like follow in your .zshrc file.

Warning: Refusing to link macOS provided/shadowed software: icu4c
If you need to have icu4c first in your PATH, run:
  echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.zshrc

For compilers to find icu4c you may need to set:
  export LDFLAGS="-L/usr/local/opt/icu4c/lib"
  export CPPFLAGS="-I/usr/local/opt/icu4c/include"

For pkg-config to find icu4c you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment