I encountered the same problem, but clearing DYLD_* didn't help.
Adding below to ~/matlab/startup.m solved the issue though.
setenv('DYLD_LIBRARY_PATH',[ '/opt/X11/lib:/opt/ni_tools/afni:' getenv('DYLD_LIBRARY_PATH') ])
The new paths prefixed to the old are from the bash environment where afni commands run successively.
$ env |grep DYLD
DYLD_FALLBACK_LIBRARY_PATH=/opt/X11/lib:/opt/ni_tools/afni: