AFNI Installation Issues M2

Hello, I am having issues installing AFNI on my Apple M2 Max with macOS 14.7.2 using a bash shell. I have gone through all of the instructions to the best of my ability and created a conda environment for the python functions. One issue is that I'm having trouble automatically adding abin to my path upon startup. This is my .bashrc file:

eval "$(/opt/homebrew/bin/brew shellenv bash)"

export PATH=${PATH}:/opt/homebrew/opt/python/libexec/bin

# -------------------------------------------------------

# for AFNI: auto-inserted by init_user_dotfiles.py

# add AFNI abin to PATH

export PATH=${PATH}:/Users/jourdan.pouliot/abin

# set up tab completion for AFNI programs

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

then

source $HOME/.afni/help/all_progs.COMP.bash

fi

# -------------------------------------------------------

# -------------------------------------------------------

# for AFNI: auto-inserted by init_user_dotfiles.py

# look for shared libraries under flat_namespace

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

-------------------------------------------------------

But even when I add abin to my path during the session. I am unable to start AFNI using the afni command. Below is the output for afni_system_check.py -check_all:

-------------------------------- general ---------------------------------
architecture:         64bit 
cpu type:             arm64
system:               Darwin
release:              23.6.0
version:              Darwin Kernel Version 23.6.0: Fri Nov 15 15:11:49 PST 2024; root:xnu-10063.141.1.702.7~1/RELEASE_ARM64_T6020
distribution:         14.7.2
number of CPUs:       12
user:                 jourdan.pouliot
apparent login shell: bash
shell RC file:        .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni           :
                     : 
AFNI_version.txt     : AFNI_25.0.07, anyos_text_atlas, Feb 25 2025, local
which python         : /Users/jourdan.pouliot/miniconda3/envs/py3_afni_mid/bin/python
python version       : 3.12.9
which R              : /usr/local/bin/R
R version            : R version 4.3.1 (aarch64-apple-darwin20)

instances of various programs found in PATH:
    afni    : 0 
    R       : 1   (/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/bin/R)
    python  : 1   (/Users/jourdan.pouliot/miniconda3/envs/py3_afni_mid/bin/python3.12)
    python2 : 0 
    python3 : 2 
      /Users/jourdan.pouliot/miniconda3/envs/py3_afni_mid/bin/python3.12
      /usr/bin/python3

testing ability to start various programs...
    afni                 : FAILURE
        /bin/sh: afni: command not found
    suma                 : FAILURE
        /bin/sh: suma: command not found
    3dSkullStrip         : FAILURE
        /bin/sh: 3dSkullStrip: command not found
    3dAllineate          : FAILURE
        /bin/sh: 3dAllineate: command not found
    3dRSFC               : FAILURE
        /bin/sh: 3dRSFC: command not found
    SurfMesh             : FAILURE
        /bin/sh: SurfMesh: command not found
    3dClustSim           : FAILURE
        /bin/sh: 3dClustSim: command not found
    build_afni.py        : success
    uber_subject.py      : success
    3dMVM                : FAILURE
        Error in library(data.table) : there is no package called ‘data.table’
        Calls: source ... suppressPackageStartupMessages -> withCallingHandlers -> library
        Execution halted
    rPkgsInstall         : FAILURE
        

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

which tcsh           : /bin/tcsh
tcsh version         : 6.21.00
which Xvfb           : /opt/X11/bin/Xvfb

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

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

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

++ module loaded: matplotlib.pyplot
   module file : /Users/jourdan.pouliot/miniconda3/envs/py3_afni_mid/lib/python3.12/site-packages/matplotlib/pyplot.py
   matplotlib version : 3.10.0

++ module loaded: flask
   module file : /Users/jourdan.pouliot/miniconda3/envs/py3_afni_mid/lib/python3.12/site-packages/flask/__init__.py
   flask version : 3.1.0

++ module loaded: flask_cors
   module file : /Users/jourdan.pouliot/miniconda3/envs/py3_afni_mid/lib/python3.12/site-packages/flask_cors/__init__.py
   flask_cors version : 3.0.10

-------------------------------- env vars --------------------------------
PATH                       = /Users/jourdan.pouliot/miniconda3/envs/py3_afni_mid/bin:/Users/jourdan.pouliot/miniconda3/condabin:/usr/local/bin:/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/X11/bin:/Users/jourdan.pouliot/abin

PYTHONPATH                 = 
R_LIBS                     = 
LD_LIBRARY_PATH            = 
DYLD_LIBRARY_PATH (sub-shell) = :/opt/X11/lib/flat_namespace
DYLD_FALLBACK_LIBRARY_PATH (sub-shell) = 
CONDA_SHLVL                = 2
CONDA_DEFAULT_ENV          = py3_afni_mid
CC                         = 

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

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

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

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

   -- good: .cshrc seems to contain 'source .tcshrc'
   -- 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 3 dot files
   
------------------------------ data checks -------------------------------
data dir : missing AFNI_data6
data dir : missing AFNI_demos
data dir : missing suma_demo
data dir : missing afni_handouts
atlas    : did not find TT_N27+tlrc

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


** no package manager found (okay for bootcamp)
which git            : /usr/bin/git
git version          : git version 2.39.5 (Apple Git-154)
which gcc            : /usr/bin/gcc
gcc version          : Apple clang version 16.0.0 (clang-1600.0.26.6)

brew gcc(s)          : /opt/homebrew/bin/gcc-14
CommandLineTools SDK : MacOSX15.2.sdk

=========================  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
*  missing program: afni
*  failure under initial "AFNI and related program tests"
*  AFNI programs show FAILURE
*  missing R packages (see rPkgsInstall)
*  please run: "suma -update_env" for .sumarc
*  please run: apsearch -update_all_afni_help
*  insufficient data for AFNI bootcamp
   (see "Prepare for Bootcamp" on install pages)
*  possibly missing atlases

I would appreciate any help you can give me.

Best wishes,
Jourdan

Hi Jourdan,

This is probably because your build of the AFNI binaries failed. The anyos_text_atlas package is installed, but that does not come with any binaries.
What is the output from:

tail -n 30 ~/afni_build/build_src/log_make.txt

Thanks,
-rick

Hi Rick,

Sorry for the delay in getting back to you. I entered the command as instructed and got the following output:

PSY-4TCGQQF:~ jourdan.pouliot$ tail -n 30 ~/afni_build/build_src/log_make.txt
tail: /Users/jourdan.pouliot/afni_build/build_src/log_make.txt: No such file or directory

Let me know of any follow-up steps I need to take. In case this helps, I do have an abin directory in my User directory and it has many commands such as afni_proc.py and @ANATICOR, but not the afni command.

Best wishes,
Jourdan

Hi Jourdan,

Okay, let's back up a little. What installation are you following, the macOS_12_Silicon ones? If so, how far have you gotten (A,B,C,D,E,F)? I would expect that anyos_text_atlas package to come from the last step.

To be sure, do you have a ~/afni_build direcotry?

If those are the directions you have followed, maybe it would be best to just rerun step E and see h ow it goes.

tcsh OS_notes.macos_12_ARM_b_user.tcsh

-rick

Hi Rick,

Thanks for your reply. I am following the tutorial you linked. I have gone through all instructions A through F, including creating a conda environment, py3_afni_mid. I also have an afni_build directory. I re-ran step E and still do not have the afni command in abin. I have pasted the output below.

Best wishes,
Jourdan

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5083 100 5083 0 0 50096 0 --:--:-- --:--:-- --:--:-- 50326
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 : arm64
CPU : arm64
echo R ver : 4.3.1
R ver : 4.3.1
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/jourdan.pouliot/abin/init_user_dotfiles.py ) 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/jourdan.pouliot/abin/init_user_dotfiles.py -shell_list bash zsh tcsh -do_updates path apsearch -dir_bin /Users/jourdan.pouliot/abin
-- good: .cshrc seems to contain 'source .tcshrc'
-- 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
/Users/jourdan.pouliot/abin/init_user_dotfiles.py
if ( 0 ) then
if ( arm64 == x86_64 ) then
set package = macos_13_ARM
endif
echo ++ compiling AFNI package macos_13_ARM
++ compiling AFNI package macos_13_ARM
echo ++ running: build_afni.py -build_root ~/afni_build -package macos_13_ARM
++ running: build_afni.py -build_root ~/afni_build -package macos_13_ARM
build_afni.py -build_root /Users/jourdan.pouliot/afni_build -package macos_13_ARM

-- build_afni.py, version 0.14, November 17, 2024
-- current AFNI: AFNI_25.0.07, anyos_text_atlas, Feb 25 2025
-- cleaning old build root dir, /Users/jourdan.pouliot/afni_build
-- backing up dir build_src
-- preparing build_root dir, /Users/jourdan.pouliot/afni_build
-- have default git tag LAST_TAG, will checkout AFNI_25.0.09
-- checking out git tag AFNI_25.0.09
-- using repo branch (detached), tag AFNI_25.0.09
-- moving old atlas dir afni_atlases_dist to prev/afni_atlases_dist
-- downloading AFNI atlas package, afni_atlases_dist.tgz
-- unpacking atlas package, afni_atlases_dist
-- moving old niivue niivue_afni.umd.js to prev/niivue_afni.umd.js
-- downloading NiiVue, niivue_afni.umd.js

-- preparing to run 'make' build of package macos_13_ARM
-- copying README files
-- copying Makefile.macos_13_ARM to Makefile
-- building make target 'itall'

-- consider monitoring the build in a separate window with:
cd /Users/jourdan.pouliot
tail -f /Users/jourdan.pouliot/afni_build/build_src/log_make.txt
# use ctrl-c to terminate 'tail' command (not the build)
++ building (please be patient)...
** error: failed run_cmd: make AFNI_WHOMADEIT=build itall >& log_make.txt
-- status: building FAILURE
see 'make' log file /Users/jourdan.pouliot/afni_build/build_src/log_make.txt
** error: tail from log_make.txt:

*** GLIB 1.2.8 or better is required. The latest version of GLIB
*** is always available from ftp://ftp.gtk.org/.
make[2]: *** No rule to make target `clean'. Stop.
make[2]: *** No targets specified and no makefile found. Stop.
error: /Library/Developer/CommandLineTools/usr/bin/ranlib: can't open file: src/.libs/libgts.a (No such file or directory)
cp: src/.libs/libgts.a: No such file or directory
make[1]: *** [libgts.a] Error 1
cp: SUMA/libgts.a: No such file or directory
cp: SUMA/libgts.a: No such file or directory
make: *** [libgts.a] Error 1

** warning: in conda environment
CONDA_SHLVL = 0, CONDA_DEFAULT_ENV = py3_afni_mid

-- shell/system command history is in:
/Users/jourdan.pouliot/afni_build/hist_commands.txt

++ screen text history is in:
/Users/jourdan.pouliot/afni_build/hist_messages.txt

rehash
if ( ! 0 ) then
echo ++ setting R_LIBS=/Users/jourdan.pouliot/sw/R-4.3.1
++ setting R_LIBS=/Users/jourdan.pouliot/sw/R-4.3.1
setenv R_LIBS /Users/jourdan.pouliot/sw/R-4.3.1
echo export R_LIBS=/Users/jourdan.pouliot/sw/R-4.3.1
echo export R_LIBS=/Users/jourdan.pouliot/sw/R-4.3.1
echo setenv R_LIBS /Users/jourdan.pouliot/sw/R-4.3.1
else
if ( ! -d /Users/jourdan.pouliot/sw/R-4.3.1/data.table ) then
echo ++ building R libraries: rPkgsInstall -pkgs ALL
++ building R libraries: rPkgsInstall -pkgs ALL
mkdir -p /Users/jourdan.pouliot/sw/R-4.3.1
rPkgsInstall -pkgs ALL
tee out.rPkgsInstall.txt

** ERROR: Failed to load R_io.so

What is the output from:

echo $HOMEBREW_PREFIX

Thanks,
-rick