I'm calling MATLAB from my c++ code via the MATLAB Engine API library on a Mac. I learned that I need to set the environment variable:
export PATH='/Applications/MATLAB_R2015a.app/bin:$PATH'
export DYLD_LIBRARY_PATH='/Applications/MATLAB_R2015a.app/bin/maci64:/Applications/MATLAB_R2015a.app/sys/os/maci64:$DYLD_LIBRARY_PATH'
then I was able to setup the Matlab engine running. However I realised the setting of those environment variables have other effects: within the shell, curl stops working. What's worse is that some multi-threaded codes compiled by openmp stop working as well. I hope to find an alternative way of setting the environment for Matlab API, without disrupting other applications. Thanks.