$ brew install icu4c
$ echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
$ echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.bash_profile
$ export LDFLAGS="-L/usr/local/opt/icu4c/lib"
$ export CPPFLAGS="-I/usr/local/opt/icu4c/include"
$ export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"
This step is done to combat the error Symbol not found: __ZNK6icu_6114Transliterator12getTargetSetERNS_10UnicodeSetE
. This, allegedly, is a sign of a "shared library mismatch between the ICU version we are using and the one actually used when building the package" (Thanks Siddharth Das) because OSX has a pre-existing ICU library in /usr/library/libicucore.dylib
ln -s /usr/local/Cellar/icu4c/61.1/bin/icu-config /usr/local/bin/icu-config
All of these flags might not be necessary, but overkilling it works
ln -s /usr/local/Cellar/icu4c/61.1/bin/icu-config /usr/local/bin/icu-config
PYICU_CFLAGS=-std=c++11 PYICU_LFLAGS=-L/usr/local/opt/icu4c/lib CFLAGS=-I/usr/local/opt/icu4c/include LDFLAGS=-L/usr/local/opt/icu4c/lib pip install pyicu
Resources:
http://www.leonidessaguisagjr.name/?p=199
lovell/sharp#1133
https://stackoverflow.com/questions/50217214/import-error-for-icu-in-mac-and-ubuntu-although-pyicu-is-installed-correctly/50364835#50364835