Catalina, zsh, xQuartz, etc.

Hi all,

I am trying to install AFNI on a new MacBook Pro running Catalina. I followed the instructions except that I avoided homebrew (I use macports) and kept R 4 instead of R 3.6. I know that AFNI is not compatible with the newer version of R and that’s fine for the moment (I haven’t yet decided whether to roll back R to the previous version, because of other constraint). On this laptop, I mainly will use AFNI for visualization and a few terminal scripts that probably won’t involve R.

My issues (at the moment) are two:

  1. I am using zsh, and every time I open a terminal, I get a very long list of messages of the following type:

Users/gp/.afni/help/all_progs.COMP.bash:589: command not found: complete
/Users/gp/.afni/help/all_progs.COMP.bash:590: command not found: complete
/Users/gp/.afni/help/all_progs.COMP.bash:591: command not found: complete
/Users/gp/.afni/help/all_progs.COMP.bash:592: command not found: complete

From the message board I saw that the “complete” command is not part of the zsh set. Is there a way to solve this without changing the default shell to zsh?

  1. I am not able to launch AFNI from the terminal because, even though I get no error, XQuartz is not launched. I have installed the latest version of XQuartz and followed Justin’s instructions for giving Full Disk Access to launchd_startx, Terminal, and XQuartz (I even threw zsh in there for good measure). Still, it doesn’t work.

In the following is the output of -check_all. Note also the error about DYLD_LIBRARY_PATH, although I have the line:

export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/opt/X11/lib/flat_namespace

in both my .bashrc and .zshenv files.

Any help much appreciated!


-------------------------------- general ---------------------------------
architecture: 64bit
system: Darwin
release: 19.6.0
version: Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64
distribution: unknown Darwin
number of CPUs: 8
apparent login shell: zsh
shell RC file: .zshenv (exists)

--------------------- AFNI and related program tests ---------------------
which afni : /Users/gp/abin/afni
afni version : Precompiled binary macos_10.12_local: Sep 1 2020
: AFNI_20.2.16 ‘Aulus Vitellius’
AFNI_version.txt : AFNI_20.2.16, macos_10.12_local, Sep 01 2020
which python : /usr/bin/python
python version : 2.7.16
which R : /opt/local/bin/R
R version : R version 4.0.2 (2020-06-22) – “Taking Off Again”
which tcsh : /bin/tcsh

instances of various programs found in PATH:
afni : 1 (/Users/gp/abin/afni)
R : 1 (/opt/local/Library/Frameworks/R.framework/Versions/4.0/Resources/bin/R)
python : 1 (/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7)
python2 : 1 (/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7)
python3 : 1 (/usr/bin/python3)

testing ability to start various programs…
afni : success
suma : success
3dSkullStrip : success : success
3dAllineate : success
3dRSFC : success
SurfMesh : success
3dClustSim : success
3dMVM : success

checking for R packages…
rPkgsInstall -pkgs ALL -check : FAILURE

    oo Warning: 
       These packages are not installed on the computer: afex!
    These packages are not installed on the computer: phia!
    These packages are not installed on the computer: snow!
    These packages are not installed on the computer: lmerTest!
    These packages are not installed on the computer: paran!
    These packages are not installed on the computer: brms!
    These packages are not installed on the computer: corrplot!
    These packages are not installed on the computer: metafor!

R RHOME : /opt/local/Library/Frameworks/R.framework/Resources

checking for $HOME files…
.afnirc : found
.sumarc : found
.afni/help/all_progs.COMP : found

------------------------------ python libs -------------------------------
** failed to load module PyQt4
– PyQt4 is no longer needed for an AFNI bootcamp

++ module loaded: matplotlib.pyplot
module file : /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/pyplot.pyc

-------------------------------- env vars --------------------------------
PATH = /opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/gp/abin


------------------------------ data checks -------------------------------
data dir : missing AFNI_data6
data dir : missing AFNI_demos
data dir : missing suma_demo
data dir : missing afni_handouts
atlas : found TT_N27+tlrc under /Users/gp/abin

------------------------------ OS specific -------------------------------
XQuartz version : 2.7.11

which port : /opt/local/bin/port
port version : Version: 2.6.3

++ found 1 dylib files under ‘/opt/X11/lib/flat_namespace’
– found ‘libXt’ dylib files:
** env var DYLD_LIBRARY_PATH is not set to contain /opt/X11/lib/flat_namespace
(so afni and suma may fail)

========================= summary, please fix: =========================

  • just be aware: login shell ‘zsh’, but our code examples use ‘tcsh’
  • shell zsh : good: found env shell setup file .zshenv
  • missing R packages (see rPkgsInstall)
  • insufficient data for AFNI bootcamp
  • OS X version might be old
  • consider setting DYLD_LIBRARY_PATH to /opt/X11/lib/flat_namespace


Try adding this to your .zshrc (create it if it is not there)

export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/opt/X11/lib/flat_namespace

and to remove the errors you see, you can comment out from your zshenv or where ever it is:

if [ -f $HOME/.afni/help/all_progs.COMP.bash ]
   . $HOME/.afni/help/all_progs.COMP.bash ]

That may get rid of the errors, but you won’t be able to use the auto complete.

let me know how if any of that helps, and we can go from there.

Thanks, Justin

Hi Justin,

good to hear from you! Thank you for your quick reply and sorry for my late one :-). I just reinstalled AFNI from scratch today using the latest build and your instructions, and it seems to work well so far. I wonder if it may even work with R 4.0.2.

hope everything’s well

Hi Giuseppe,

There were recent updates to @update.afni.binaries, and apsearch to deal with zsh, including for AFNI command option completion (apsearch) and setting up .zshrc (in @update.afni.binaries).

The zsh format for option completion is more restricted than the bash format, so we had to create new files for zsh.

The 10.12_local package is still compiled against R 3.6. That is not an AFNI restriction, it is a macos_10.12_local package restriction (which is currently the only mac package we build). We plan to build against 4.0 as well, in a new package, but have not gotten to it yet. Sorry.

  • rick