That is interesting. If it is failing in bash, then maybe there is a discrepancy between whatever libXp is being shipped with FreeSurfer and the one that is otherwise on your system. But to be sure, let's forget doing it from a script for now. Since your login shell is bash, just try running commands by hand.
1. from your bash terminal, can you start afni?
2. assuming that fails, would you first adjust the DYLD variable?
export DYLD_LIBRARY_PATH=/opt/X11/lib/flat_namespace
afni
Does that work?
- rick