Trouble when installing AFNI with macOS Big Sur (version 11.2)

Hi AFNI support team,

I take the liberty of reaching out regarding an issue that I am facing when trying to install AFNI on my new machine under macOS Bis Sur (version 11.2). I have followed carefully each step described here “1.1.7. Mac OS” and after reviewing the message board for some hints about how to fix these issues, I am still stuck.

First, I got a message error at the step where I had to run the following command ‘suma -update_env’, whereas I completed each step described previously.

(base) Claudies-MBP:~ claudie$ suma -update_env
-bash: suma: command not found

Based on what I could find on the message board, I ran the following command line to set the path:

(base) Claudies-MBP:~ claudie$ export PATH=$PATH:~/abin

After setting the path, I ran again the following command and here is what I got:

(base) Claudies-MBP:~ claudie$ suma -update_env
dyld: Library not loaded: /opt/X11/lib/libXp.6.dylib
Referenced from: /Users/claudie/abin/suma
Reason: image not found
Abort trap: 6

I nevertheless rebooted my system and tried to move forward by (1) installing R-3.6.3 and (2) running the following command ‘sudo rPkgsInstall -pkgs ALL’. Here is what I got.

(base) Claudies-MBP:~ claudie$ sudo rPkgsInstall -pkgs ALL
updating R_LD_LIBRARY_PATH …
R: Command not found.
R: Command not found.

Did I miss something in the installation process?

Many thanks for your time and help!

Kind regards,


Hi Claudie,

To be sure, did you reboot after running @update.afni.binaries?
Also, are you using an M1 mac?

It looks like XQuartz and R are not installed. Did you run through those steps?

And to provide more detail, would you show the full output from -check_all


  • rick

Hi Rick,

Many thanks for getting back regarding this issue. I am using a M1 mac with macOS Big Sur (version 11.2) installed.

I rebooted my machine after running the command below:

cp $HOME/abin/AFNI.afnirc $HOME/.afnirc
suma -update_env

Of note, I did not run the curl command. Therefore, I am wondering whether it might have something to do with this.

Concerning XQuartz and R, I did install both of them and selected R version 3.6.3 as recommended. I can see both of them in my Applications’ directory.

Please find below the full output from

Many thanks!


bash-3.2$ -check_all
-------------------------------- general ---------------------------------
architecture: 64bit
system: Darwin
release: 20.3.0
version: Darwin Kernel Version 20.3.0: Thu Jan 21 00:06:51 PST 2021; root:xnu-7195.81.3~1/RELEASE_ARM64_T8101
distribution: 10.16
number of CPUs: 8
apparent login shell: bash
shell RC file: .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni : /Users/claudie/abin/afni
afni version : dyld: Library not loaded: /opt/X11/lib/libXp.6.dylib
AFNI_version.txt : AFNI_21.0.12, macos_10.12_local, Feb 25 2021
which python : /opt/anaconda3/bin/python
python version : 3.8.5
which R :
which tcsh : /bin/tcsh

instances of various programs found in PATH:
afni : 1 (/Users/claudie/abin/afni)
R : 0
python : 2
python2 : 1 (/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7)
python3 : 2

testing ability to start various programs…
afni : FAILURE
dyld: Library not loaded: /opt/X11/lib/libXp.6.dylib
Referenced from: /Users/claudie/abin/afni
Reason: image not found
suma : FAILURE
dyld: Library not loaded: /opt/X11/lib/libXp.6.dylib
Referenced from: /Users/claudie/abin/suma
Reason: image not found
3dSkullStrip : FAILURE
dyld: Library not loaded: /opt/X11/lib/libXp.6.dylib
Referenced from: /Users/claudie/abin/3dSkullStrip
Reason: image not found : success
3dAllineate : FAILURE
dyld: Library not loaded: /opt/X11/lib/libXp.6.dylib
Referenced from: /Users/claudie/abin/3dAllineate
Reason: image not found
dyld: Library not loaded: /opt/X11/lib/libXp.6.dylib
Referenced from: /Users/claudie/abin/3dRSFC
Reason: image not found
SurfMesh : FAILURE
dyld: Library not loaded: /opt/X11/lib/libXp.6.dylib
Referenced from: /Users/claudie/abin/SurfMesh
Reason: image not found
3dClustSim : FAILURE
dyld: Library not loaded: /opt/X11/lib/libXp.6.dylib
Referenced from: /Users/claudie/abin/3dClustSim
Reason: image not found
3dMVM : success

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

R RHOME : R: Command not found.

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

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

++ module loaded: matplotlib.pyplot
module file : /opt/anaconda3/lib/python3.8/site-packages/matplotlib/

-------------------------------- env vars --------------------------------
PATH = /opt/anaconda3/bin:/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/claudie/abin

DYLD_LIBRARY_PATH (sub-shell) = :/opt/X11/lib/flat_namespace

------------------------------ 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/claudie/abin

------------------------------ OS specific -------------------------------
XQuartz version : 2.8.0_rc2

** no package manager found (okay for bootcamp)
++ found 1 dylib files under ‘/opt/X11/lib/flat_namespace’
– found ‘libXt’ dylib files:
– recent OS X, cheating to check DYLD_LIBRARY_PATH in cur shell ‘bash’…
++ found evar DYLD_LIBRARY_PATH = :/opt/X11/lib/flat_namespace
– recent OS X, cheating to check DYLD_LIBRARY_PATH in shell ‘tcsh’…
++ found evar DYLD_LIBRARY_PATH = /opt/X11/lib/flat_namespace

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

  • just be aware: login shell ‘bash’, but our code examples use ‘tcsh’
  • shell bash: consider sourcing (non-login) .bashrc from (login) .bash_profile
  • failure under initial “AFNI and related program tests”
  • AFNI programs show FAILURE
  • please run: “suma -update_env” for .sumarc
  • please run: apsearch -update_all_afni_help
  • insufficient data for AFNI bootcamp

Hi Claudie,

I am not sure about R (did you install that in a different conda environment?), but it is strange that libXp is not being found. Daniel said that some of the recent XQuartz packages had issues. What is the output from this?

 ls -ld /opt/X11/lib/libXp.*


  • rick

Hi Rick,

I installed XQuartz and R with the default location suggested during the installation process. I don’t know exactly why it cannot be found via the Terminal. Please find below the output from the ls -ld /opt/X11/lib/libXp.* command.

bash-3.2$ ls -ld /opt/X11/lib/libXp.*
ls: /opt/X11/lib/libXp.*: No such file or directory

Out of curiosity, would it be recommended to update the version of bash that I have currently? I could read that the bash version installed by default on macOS is somehow outdated.

Many thanks!


Hi Claudie,

I’m not sure about bash in particular. We have seen some issues with the shell under Rosetta…

But it does look like XQuartz is not quite there. Can you reinstall that and see if those libXp files are then found?
I think Macos 11 is stlil going through some growing pains.


  • rick

Hi Rick,

Thanks again for helping with this issue.

I uninstalled XQuartz and reinstalled it (version 2.8.0). The libXp files are still not found. When running ‘suma -update_env’, here is what I get:

bash-3.2$ suma -update_env
dyld: Library not loaded: /opt/X11/lib/libXp.6.dylib
Referenced from: /Users/claudie/abin/suma
Reason: image not found
Abort trap: 6

Of note, I do not have X11 on this path: ‘Applications/Utilities/’, only

There are also several other weird things happening. Even though I set my Terminal in bash by default (confirmed when typing echo $0), here is what I get when trying the suma -update_env command:

(base) Claudies-MBP:~ claudie$ -check_all
-bash: command not found

(base) Claudies-MBP:~ claudie$ suma -update_env
-bash: suma: command not found

In order to get it working, I have usually to type bash again, while it should be already in bash environment.

I have have no idea how to circumvent/fix this bunch of issues.

Many thanks,

Hi Claudie,

I am not sure why the libXp files are not there. But we are pondering a build change to get around that problem. However, it has the chance of affecting others.

It seems like your PATH is not set up in ~/.zshrc. Does abin get added to your PATH in there? If this is not resolved soon, maybe we should try a zoom meeting.

  • rick

I also use Big Sur and I’ve had exactly the same issues!!

Hi Rick,

I set the environment variable after having installed XQuartz and it seems that abin was well added to my path. However, the libXp files cannot be found and I don’t know exactly from where comes the issue and how to fix this.
A zoom meeting would certainly be very helpful to figure out where does this issue stem from.

Thanks a lot for the help with this issue!

All the best,


Hi, I am also running into this exact problem when trying to set up AFNI (dyld: Library not loaded: /opt/X11/lib/libXp.6.dylib after running the suma -update_env command), except that I am using an Intel mac with Catalina.

Hi all,

Thank you for the comments, and thanks to Claudie for testing the updates. There should be a fix in for this now (at least for the AFNI binaries and libXp errors). Once a build finishes, you should be able to update to a working package. I will send another message then.

Note that the “missing R” error is still a problem with R itself not being ready yet. We will just have to wait for them. Rstudio is getting installed with Big Sur (so it is under /Applications), but there is no /usr/bin/R script yet (that I know of). Once R has that ready, you will need to get the R update for it (i.e. probably just install the latest R package). That will probably not take them too much longer.

More in a couple/few hours…

  • rick

The updated binaries are ready. Please update and let me know if there are questions or difficulties.

@update.afni.binaries -d

Oh wait. This will probably not work, since it will want a working afni to get the version from.
Consider a more extended form of the command then, to specify the package

@update.afni.binaries -package macos_10.12_local -defaults


  • rick

Hey Rick,

R seemed to work for me after I tried installing it through Homebrew rather than the r-project website. Just an FYI!

That’s great! Also, the 'R" script itself might be coming with the install, except perhaps it has not been put into /usr/bin, say. I have not gotten around to verifying that.


  • rick

Dear AFNI experts/users,

I just want to confirm that this solution works for me too, on macOS Big Sur version 11.3 (MacBook Pro - 2020). Thanks for your help!

Many thanks again Rick for creating these updates and fixing this so quick!
All the best,