AFNI installation issue: "ERROR: Failed to load R_io.so"

Dear All!

I am installing the AFNI on a Mac with a M2 Max , however at the last command step (tcsh OS_notes.macos_12_ARM_b_user.tcsh) I keep getting this error message, even-though the correct and newest R is installed for my computer. ("/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library").
I was thinking that I might need to set some additional PATH to my nanobash profile, but I am genuinely a bit clueless what to do next.

Could anyone assist me in this matter?

Error message:

nimbus:~anneliesvantwesteinde$ tcsh OS_notes.macos_12_ARM_b_user.tcsh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  5083  100  5083    0     0  23688      0 --:--:-- --:--:-- --:--:-- 23752
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.4.2
R ver : 4.4.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/anneliesvantwesteinde/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/anneliesvantwesteinde/abin/init_user_dotfiles.py -shell_list bash zsh tcsh -do_updates path apsearch -dir_bin /Users/anneliesvantwesteinde/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
/Users/anneliesvantwesteinde/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/anneliesvantwesteinde/afni_build -package macos_13_ARM

-- build_afni.py, version 0.14, November 17, 2024
-- current AFNI: AFNI_25.0.06, anyos_text_atlas, Feb 12 2025
-- cleaning old build root dir, /Users/anneliesvantwesteinde/afni_build
-- backing up dir build_src
-- preparing build_root dir, /Users/anneliesvantwesteinde/afni_build
-- have default git tag LAST_TAG, will checkout AFNI_25.0.06
-- checking out git tag AFNI_25.0.06
-- using repo branch (detached), tag AFNI_25.0.06
-- removing old atlas dir, prev/afni_atlases_dist
-- 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
-- removing old NiiVue backup, prev/niivue_afni.umd.js
-- 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/anneliesvantwesteinde
       tail -f /Users/anneliesvantwesteinde/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/anneliesvantwesteinde/afni_build/build_src/log_make.txt
** error: tail from log_make.txt:
   --------------------------------------------------
   checking for C compiler default output file name... configure: error: C compiler cannot create executables
   See config.log' for more details.
   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
   --------------------------------------------------


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

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

rehash
if ( ! 1 ) then
echo -- already have R_LIBS=/Users/anneliesvantwesteinde/sw/R-4.3.1
-- already have R_LIBS=/Users/anneliesvantwesteinde/sw/R-4.3.1
endif
if ( ! -d /Users/anneliesvantwesteinde/sw/R-4.3.1/data.table ) then
echo ++ building R libraries: rPkgsInstall -pkgs ALL
++ building R libraries: rPkgsInstall -pkgs ALL
mkdir -p /Users/anneliesvantwesteinde/sw/R-4.3.1
rPkgsInstall -pkgs ALL
tee out.rPkgsInstall.txt

** ERROR: Failed to load R_io.so

nano ~/.bash_profile:

FSLDIR=/Users/anneliesvantwesteinde/fsl

. ${FSLDIR}/etc/fslconf/fsl.sh

PATH=${FSLDIR}/bin:${PATH}

export FSLDIR PATH

export FREESURFER_HOME=/Applications/freesurfer/7.4.1

export FSFAST_HOME=/Applications/freesurfer/7.4.1/fsfast

export SUBJECTS_DIR=$FREESURFER_HOME/subjects

source $FREESURFER_HOME/SetUpFreeSurfer.sh

export ANTSPATH=/opt/ants/bin

export PATH=${ANTSPATH}:$PATH

Many thanks in advance!