AFNI Installation Issues: Mac OS 26.4.1 (M4 Chip)

Hello! I'm in the process of reinstalling AFNI after a while of not using it since I ran into issues trying to open the GUI. Can anyone help walk me through how to fix the errors I'm seeing? I pasted the whole script below. Thank you in advance!

Last login: Thu Apr 16 14:06:27 on ttys000
init_user_dotfiles.py: Command not found.
[MacBook-Pro-10:~] chuckb% cd
curl -O https://raw.githubusercontent.com/afni/afni/master/src/other_builds/OS_notes.macos_12_ARM_a_admin_pt1.zsh
curl -O https://raw.githubusercontent.com/afni/afni/master/src/other_builds/OS_notes.macos_12_ARM_a_admin_pt2.zsh
curl -O https://raw.githubusercontent.com/afni/afni/master/src/other_builds/OS_notes.macos_12_ARM_b_user.tcsh[MacBook-Pro-10:~] chuckb% curl -O https://raw.githubusercontent.com/afni/afni/master/src/other_builds/OS_notes.macos_12_ARM_a_admin_pt1.zsh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2323  100  2323    0     0  16579      0 --:--:-- --:--:-- --:--:-- 16592
[MacBook-Pro-10:~] chuckb% curl -O https://raw.githubusercontent.com/afni/afni/master/src/other_builds/OS_notes.macos_12_ARM_a_admin_pt2.zsh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1194  100  1194    0     0   9736      0 --:--:-- --:--:-- --:--:--  9707
[MacBook-Pro-10:~] chuckb% curl -O https://raw.githubusercontent.com/afni/afni/master/src/other_builds/OS_notes.macos_12_ARM_b_user.tcsh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1312  100  1312    0     0  11104      0 --:--:-- --:--:-- --:--:-- 11118
[MacBook-Pro-10:~] chuckb% zsh OS_notes.macos_12_ARM_a_admin_pt1.zsh
++ Beginning homebrew installation on this ARM system
==> Checking for `sudo` access (which may request your password)...
Password:
==> This script will install:
/opt/homebrew/bin/brew
/opt/homebrew/share/doc/homebrew
/opt/homebrew/share/man/man1/brew.1
/opt/homebrew/share/zsh/site-functions/_brew
/opt/homebrew/etc/bash_completion.d/brew
/opt/homebrew
/etc/paths.d/homebrew

Press RETURN/ENTER to continue or any other key to abort:
==> /usr/bin/sudo /usr/sbin/chown -R chuckb:admin /opt/homebrew
==> Downloading and installing Homebrew...
==> /usr/bin/sudo /bin/mkdir -p /etc/paths.d
==> /usr/bin/sudo tee /etc/paths.d/homebrew
/opt/homebrew/bin
==> /usr/bin/sudo /usr/sbin/chown root:wheel /etc/paths.d/homebrew
==> /usr/bin/sudo /bin/chmod a+r /etc/paths.d/homebrew
==> Updating Homebrew...
==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics data has been sent yet (nor will any be during this install run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations

==> Next steps:
- Run brew help to get started
- Further documentation:
    https://docs.brew.sh

Warning: python@3.14 3.14.4 is already installed and up-to-date.
To reinstall 3.14.4, run:
  brew reinstall python@3.14
Warning: netpbm 11.02.23 is already installed and up-to-date.
To reinstall 11.02.23, run:
  brew reinstall netpbm
Warning: cmake 4.3.1 is already installed and up-to-date.
To reinstall 4.3.1, run:
  brew reinstall cmake
Warning: gcc 15.2.0_1 is already installed and up-to-date.
To reinstall 15.2.0_1, run:
  brew reinstall gcc

== installing XQuartz (needs sudo)

Warning: Not upgrading xquartz, the latest version is already installed
Warning: libpng 1.6.58 is already installed and up-to-date.
To reinstall 1.6.58, run:
  brew reinstall libpng
Warning: jpeg 10 is already installed and up-to-date.
To reinstall 10, run:
  brew reinstall jpeg
Warning: expat 2.7.5 is already installed and up-to-date.
To reinstall 2.7.5, run:
  brew reinstall expat
Warning: freetype 2.14.3 is already installed and up-to-date.
To reinstall 2.14.3, run:
  brew reinstall freetype
Warning: fontconfig 2.17.1 is already installed and up-to-date.
To reinstall 2.17.1, run:
  brew reinstall fontconfig
Warning: openmotif 2.3.8_4 is already installed and up-to-date.
To reinstall 2.3.8_4, run:
  brew reinstall openmotif
Warning: libomp 22.1.3 is already installed and up-to-date.
To reinstall 22.1.3, run:
  brew reinstall libomp
Warning: gsl 2.8 is already installed and up-to-date.
To reinstall 2.8, run:
  brew reinstall gsl
Warning: glib 2.88.0 is already installed and up-to-date.
To reinstall 2.88.0, run:
  brew reinstall glib
Warning: pkgconf 2.5.1 is already installed and up-to-date.
To reinstall 2.5.1, run:
  brew reinstall pkgconf
Warning: gcc 15.2.0_1 is already installed and up-to-date.
To reinstall 15.2.0_1, run:
  brew reinstall gcc
Warning: libiconv 1.19 is already installed and up-to-date.
To reinstall 1.19, run:
  brew reinstall libiconv
Warning: autoconf 2.73 is already installed and up-to-date.
To reinstall 2.73, run:
  brew reinstall autoconf
Warning: libxt 1.3.1 is already installed and up-to-date.
To reinstall 1.3.1, run:
  brew reinstall libxt
Warning: mesa 26.0.5 is already installed and up-to-date.
To reinstall 26.0.5, run:
  brew reinstall mesa
Warning: mesa-glu 9.0.3 is already installed and up-to-date.
To reinstall 9.0.3, run:
  brew reinstall mesa-glu
Warning: libxpm 3.5.18 is already installed and up-to-date.
To reinstall 3.5.18, run:
  brew reinstall libxpm
[MacBook-Pro-10:~] chuckb% zsh OS_notes.macos_12_ARM_a_admin_pt2.zsh
++ Beginning R installation on this ARM system
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 96.7M  100 96.7M    0     0  3056k      0  0:00:32  0:00:32 --:--:-- 8734k
Password:
installer: Package name is R 4.5.2 for macOS (ARM64)
installer: Upgrading at base path /
installer: The upgrade was successful.

  ... please reboot ...

[MacBook-Pro-10:~] chuckb% 
  [Restored Apr 16, 2026 at 2:25:39 PM]
Last login: Thu Apr 16 14:25:32 on console
init_user_dotfiles.py: Command not found.
[MacBook-Pro-10:~] chuckb% tcsh OS_notes.macos_12_ARM_b_user.tcsh

=============================================================================
init_user_dotfiles.py - initialize user dot files (.cshrc, .bashrc, ...)

   Either initialize or just evaluate dot files for: ~1~

      - having ABIN in PATH
      - (for macs) having flat_namespace in DYLD_LIBRARY_PATH
      - (optionally) sourcing apsearch tab completion setup file
           .afni/help/all_progs.COMP (depending on shell)

      - also, detect follower files
        For example if .tcshrc sources .cshrc, then .tcshrc is a follower
        and does not need be edited (though .cshrc might need editing).

   For some background, please see:

      afni_system_check.py -help_dot_files

   This program can evaluate what might need to be done to the given files.
   It can also make the needed changes.

   The potential changes to evaluate or perform are:

      1. Add ABIN to the PATH in all evaluated dot/RC files.
         ABIN can be set by -dir_bin, or else it will be come from:
            which afni_proc.py

      2. If requested and on a mac, set DYLD_LIBRARY_PATH to include
         /opt/X11/lib/flat_namespace.

      3. If requested, source all_progs.COMP for tab completion of
         AFNI command options.  For example, try typing:

            afni_proc.py -regr<tab>

         Where <tab> is pressed when the cursor is still attached to 'regr'.
         If tab completion is working, this should show many possible options
         that start with -regr (-regress, actually).  For a shorter example,
         try:

            afni -h<tab>

------------------------------------------
examples: ~1~

    0. basic terminal examples: get help or list dot files ~2~

        init_user_dotfiles.py -help
        init_user_dotfiles.py -help_dotfiles_all

    1. test dot files in the $HOME directory or in some/other/dir ~2~

        # dot files under $HOME dir
        init_user_dotfiles.py -test

        # the dot files are under some/other/dir
        init_user_dotfiles.py -test -dir_dot some/other/dir

        # specify which shells to test (implying corresponding dot files)
        init_user_dotfiles.py -test -shell_list tcsh bash

    2. do a dry run, for just the path or ALL updates ~2~

        # just PATH
        init_user_dotfiles.py -do_updates path -dir_dot DDIR -dry_run

        # all updates
        init_user_dotfiles.py -do_updates ALL -dir_dot DDIR -dry_run

    3. actually modify the files (e.g., just omit -dry_run) ~2~

        # update for PATH
        init_user_dotfiles.py -do_updates path -dir_dot DDIR

        # perform all updates
        init_user_dotfiles.py -do_updates ALL -dir_dot DDIR

        # only consider .bashrc and .cshrc
        init_user_dotfiles.py -do_updates ALL -dir_dot DDIR \
            -dflist .bashrc .cshrc

        # only consider shells bash and tcsh
        init_user_dotfiles.py -do_updates ALL -dir_dot DDIR \
            -shell_list bash tcsh

------------------------------------------
terminal options: ~1~

      -help                     : show this help
      -help_dotfiles_all        : display dot files known by program
      -help_dotfiles_mod        : display modifiable dot files
      -help_shells              : display shells known by program
      -hist                     : show module history
      -show_valid_opts          : list valid options
      -ver                      : show current version

other options:

      -dflist DFILE DFILE ...   : specify dot files to focus on
                                  (default from -help_dotfiles_mod)

         e.g. -dflist .cshrc .bashrc .zshrc

         Specify the list of RC/dot files to process.  Files outside this
         list will be ignored.

         Special cases:

            ALL : set list to all known dot files (see -help_dotfiles_all)
            MOD : set list to all modifiable dot files (see -help_dotfiles_mod)

      -dir_bin DIR_BIN          : specify bin directory to add to PATH
                                  (default comes from `which afni_proc.py`)

         e.g. -dir_bin /some/other/abin

         For use with 'path' modifications, specify the bin directory that
         would be added to the PATH.

      -dir_dot DDIR             : specify directory containing dot files

         e.g.,    -dir_dot some/dot/files/are/here
         default: -dir_dot $HOME

         Specify an alternate location of dot files, besides $HOME.
         This can be for useful if being set up by an admin, or perhaps
         for testing.
         
      -do_updates UPD UPD ...   : specify which updates to make
                                  (default is nothing)

         e.g. -do_updates flatdir
         e.g. -do_updates path apsearch
         e.g. -do_updates ALL

         Specify one or more updates to attempt.  Valid updates include:

            apsearch    : source ~/.afni/help/all_progs.COMP
                          (or all_progs.COMP.bash or all_progs.COMP.zsh)

                        * if the dotfile is not based on the login or current
                          shell (and no -force), omit apsearch update
                          (since this only applies to an interactive shell)

            flatdir     : add /opt/X11/lib/flat_namespace to DYLD_LIBRARY_PATH

            path        : add DIR_BIN to PATH

            ALL         : do all of the above

      -dry_run                  : do not modify files, but see what would happen

         e.g. -dry_run

         With this option, the program prepares to modify files, but does not
         actually perform the modifications.  Instead, the user is informed of
         what would be done, had the option not been included.

         This is intended as a test run for a command that would otherwise
         perform the operations specified by the -do_updates parameters.

         This is similar to -test, except that it restricts operations to those
         in -do_updates, plus it shows the actual text of all intended file
         modifications.  If a user wanted to make their own changes, for 
         example, they could append this modification text to each file in
         question.

            See also -test.

      -force                    : force edits, whether they seem needed or not

         e.g. -force

         When considering changes to make (operations to add to the dot files),
         if it seems to the program that the operation is already happening,
         or if it does not seem appropriate (e.g. setting DYLD_LIBRARY_PATH on
         a linux system), such a modification will be skipped.

         Use this -force option to force a change, even if it looks like such a
         change is not needed.

      -make_backup yes/no       : specify whether to make backups of originals

         e.g.,    -make_backup no
         default: -make_backup yes

         By default, this program will make a backup of any file that will be
         changed.  The backup name will be the same as a original name, plus
         the extension '.adot.bak'.  For example:
            .cshrc
         would be backed up to
            .cshrc.adot.bak

         Use this option to turn off the default behavior.

      -shell_list S1 S2 ...     : specify shells instead of using -dflist

         e.g.,    -shell_list bash tcsh
         default: -shell_list ALL

         This is an optional alternative to -dflist.  The user can specify
         a list of known shells which would imply the dot file list given by
         -dflist.  The same special cases of ALL and MOD apply.

         For example,

            -shell_list bash tcsh

         would have the same effect as:

            -dflist .bashrc .cshrc .tcshrc

         This is merely a convenience option.

            See also -dflist.

      -test                     : just test the files for potential changes

          e.g., -test

          Use this option to simply report on what changes might be needed for
          the given files.  It checks for all possibly appropriate changes,
          reporting the resulting table, and quits.

          Use -do_updates to restrict the applied tests.

            See also -dry_run, -do_updates.

      -verb LEVEL               : set the verbosity level (default 1)

          e.g., -verb 2

          Specify how verbose the program should be, from 0=quiet to 4=max.
          As is typical, the default level is 1.

-----------------------------------------------------------------------------
R Reynolds    December 2022
=============================================================================

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  5341  100  5341    0     0  21361      0 --:--:-- --:--:-- --:--:-- 21364
++ num brew shellenv found : 1
++ start building...
set os = `uname -s`
uname -s
if ( 0 ) then
if ( Darwin != Darwin ) then
set cpu = `uname -m`
uname -m
if ( 0 ) then
set rver = `R --version | head -n 1 | cut -d ' ' -f 3`
R --version
cut -d   -f 3
head -n 1
if ( 0 ) then
echo OS    : Darwin
OS    : Darwin
echo CPU   : x86_64
CPU   : x86_64
echo R ver : 4.5.2
R ver : 4.5.2
echo 

defaults write org.macosforge.xquartz.X11 wm_ffm -bool true
defaults write org.x.X11 wm_ffm -bool true
defaults write com.apple.Terminal FocusFollowsMouse -string YES
if ( ! -f /Users/chuckb/abin/afni ) then
echo -- skipping install of AFNI anyos_text_atlas
-- skipping install of AFNI anyos_text_atlas
endif
echo ++ setting up user dotfiles
++ setting up user dotfiles
/Users/chuckb/abin/init_user_dotfiles.py -shell_list bash zsh tcsh -do_updates path apsearch -dir_bin /Users/chuckb/abin
-- good: .tcshrc seems to contain 'source .cshrc'
-- considered operations: path, apsearch

-- note: followers should not need edits, so edit flags should be 0
   (have 1 follower(s), which can be ignored)

no modifications needed across 4 dot files

which init_user_dotfiles.py
if ( 0 ) then
if ( x86_64 == x86_64 ) then
set package = macos_12_x86_64
else
echo ++ compiling AFNI package macos_12_x86_64
++ compiling AFNI package macos_12_x86_64
echo ++ running: build_afni.py -build_root ~/afni_build -package macos_12_x86_64
++ running: build_afni.py -build_root ~/afni_build -package macos_12_x86_64
rm -f afni_build_messages.txt
build_afni.py -build_root /Users/chuckb/afni_build -package macos_12_x86_64 -cc_path /usr/bin/gcc -fast_log_messages afni_build_messages.txt
** error: unknown trailing arguments : ['-fast_log_messages', 'afni_build_messages.txt']
** error: failed to process options...
[MacBook-Pro-10:~] chuckb% afni_system_check.py -check_all
-------------------------------- general ---------------------------------
architecture:         64bit Mach-O
cpu type:             x86_64
system:               Darwin
release:              25.4.0
version:              Darwin Kernel Version 25.4.0: Thu Mar 19 19:33:25 PDT 2026; root:xnu-12377.101.15~1/RELEASE_ARM64_T6041
distribution:         26.4.1
number of CPUs:       14
user:                 chuckb
apparent login shell: tcsh
shell RC file:        .tcshrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni           : /Users/chuckb/abin/afni
afni version         : Precompiled binary macos_10.12_local: May 23 2025 
                     : AFNI_25.1.11 'Maximinus'
AFNI_version.txt     : AFNI_25.1.11, macos_10.12_local, May 23 2025, official
which python         : /usr/local/opt/python/libexec/bin/python
python version       : 3.13.3
which R              : /usr/local/bin/R
R version            : R version 4.5.2 (aarch64-apple-darwin20)

instances of various programs found in PATH:
    afni    : 1   (/Users/chuckb/abin/afni)
    R       : 1   (/Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/bin/R)
    python  : 2 
      /usr/local/Cellar/python@3.13/3.13.3_1/Frameworks/Python.framework/Versions/3.13/bin/python3.13
      /opt/homebrew/Cellar/python@3.14/3.14.4/Frameworks/Python.framework/Versions/3.14/bin/python3.14
    python2 : 0 
    python3 : 3 
      /opt/homebrew/Cellar/python@3.14/3.14.4/Frameworks/Python.framework/Versions/3.14/bin/python3.14
      /usr/local/Cellar/python@3.13/3.13.3_1/Frameworks/Python.framework/Versions/3.13/bin/python3.13
      /usr/bin/python3

testing ability to start various programs...
    afni                 : success
    suma                 : success
    3dSkullStrip         : success
    3dAllineate          : success
    3dRSFC               : success
    SurfMesh             : success
    3dClustSim           : success
    build_afni.py        : success
    uber_subject.py      : success
    3dMVM                : FAILURE
        Error: package or namespace load failed for ‘data.table’ in dyn.load(file, DLLpath = DLLpath, ...):
         unable to load shared object '/Users/chuckb/sw/R-4.3.1/data.table/libs/data_table.so':
          dlopen(/Users/chuckb/sw/R-4.3.1/data.table/libs/data_table.so, 0x0006): tried: '/Users/chuckb/sw/R-4.3.1/data.table/libs/data_table.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64e.v1' or 'arm64' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/chuckb/sw/R-4.3.1/data.table/libs/data_table.so' (no such file), '/Users/chuckb/sw/R-4.3.1/data.table/libs/data_table.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64e.v1' or 'arm64' or 'arm64'))
        Execution halted
    rPkgsInstall         : FAILURE
        

------------------------ dependent program tests -------------------------
checking for dependent programs...

which tcsh           : /usr/local/bin/tcsh
tcsh version         : 6.24.15
which Xvfb           : /opt/X11/bin/Xvfb

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

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

------------------------------ python libs -------------------------------

** failed to load module matplotlib.pyplot
-- matplotlib.pyplot is required

** failed to load module flask
-- flask is not required, but is desirable

** failed to load module flask_cors
-- flask_cors is not required, but is desirable

-- python binaries under /usr/local/bin:
    /usr/local/bin/python3 (sym link to /usr/local/Cellar/python@3.13/3.13.3_1/Frameworks/Python.framework/Versions/3.13/bin/python3.13)

-------------------------------- env vars --------------------------------
PATH                       = /opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/local/sbin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pkg/env/active/bin:/opt/pmk/env/global/bin:/opt/X11/bin:/Users/chuckb/abin:/usr/local/opt/python/libexec/bin:/opt/homebrew/opt/python/libexec/bin:/opt/homebrew/opt/python/libexec/bin

PYTHONPATH                 = 
R_LIBS                     = /Users/chuckb/sw/R-4.3.1
LD_LIBRARY_PATH            = 
DYLD_LIBRARY_PATH (sub-shell) = /opt/X11/lib/flat_namespace:/opt/X11/lib/flat_namespace
DYLD_FALLBACK_LIBRARY_PATH (sub-shell) = 
CONDA_SHLVL                = 0
CONDA_DEFAULT_ENV          = 
CC                         = 
HOMEBREW_PREFIX            = /opt/homebrew

----------------------------- eval dot files -----------------------------

----------- AFNI $HOME files -----------

    .afnirc                   : found
    .sumarc                   : found
    .afni/help/all_progs.COMP : found

--------- shell startup files ----------

   -- good: .tcshrc seems to contain 'source .cshrc'
   -- considered operations: path, flatdir, apsearch
   
   -- note: followers should not need edits, so edit flags should be 0
      (have 1 follower(s), which can be ignored)
   
   no modifications needed across 2 dot files
   
------------------------------ data checks -------------------------------
data dir : found AFNI_data6   under $HOME (948584M Avail)
           top history: ...d GroupAna_cases/gen_datatables/ggc_dt_commands.tcsh
data dir : found AFNI_demos   under $HOME
           top history: 22 May 2025 [taylorp]: update subject QC directories
data dir : found suma_demo    under $HOME
           top history: ...s_New/data/Build_tmp on Mon Mar  4 11:56:45 EST 2013
data dir : found afni_handouts under $HOME
atlas    : did not find TT_N27+tlrc

------------------------------ OS specific -------------------------------
XQuartz version      : 2.8.5

which brew           : /opt/homebrew/bin/brew
brew version         : Homebrew 5.1.6

which git            : /usr/local/bin/git
git version          : git version 2.49.0
which gcc            : /usr/bin/gcc
gcc version          : Apple clang version 17.0.0 (clang-1700.0.13.5)

brew gcc(s)          : /usr/local/bin/gcc-15
CommandLineTools SDK : MacOSX15.5.sdk
++ found 1 dylib files under '/opt/X11/lib/flat_namespace'
   -- found 'libXt' dylib files:
      /opt/X11/lib/flat_namespace/libXt.6.dylib
-- recent OS X, cheating to check DYLD_LIBRARY_PATH in cur shell 'tcsh'...
++ found evar DYLD_LIBRARY_PATH = /opt/X11/lib/flat_namespace:/opt/X11/lib/flat_namespace

=========================  summary, please fix:  =========================
*  AFNI programs show FAILURE
*  missing R packages (see rPkgsInstall)
*  python library matplotlib is required
   (see AFNI install docs for details)
*  possibly missing atlases

[MacBook-Pro-10:~] chuckb% afni_system_check.py -check_all > out.ASC.txt
[MacBook-Pro-10:~] chuckb%