R_io.so shows different architecture than R --version.

When I install AFNI for apple silicon on an M1 Max, and I have R 4.6.2 for arm64 already installed, I get errors.

When running afni_system_check.py -check_all

I get:

-------------------------------- general ---------------------------------
architecture:         64bit Mach-O
cpu type:             arm64
system:               Darwin
release:              25.6.0
version:              Darwin Kernel Version 25.6.0: Tue Aug 18 17:49:13 PDT 2026; root:xnu-12377.161.15.700.19~2/RELEASE_ARM64_T6000
distribution:         26.7.1
number of CPUs:       10
user:                 janeallendorfer
apparent login shell: zsh
shell RC file:        .zshrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni           : /Users/janeallendorfer/abin/afni
afni version         : Precompiled binary macos_10.12_local: Oct 23 2026 
                     : AFNI_26.3.05 'Philip the Arab'
AFNI_version.txt     : AFNI_26.3.05, macos_10.12_local, Oct 23 2026, official
afnipy version       : AFNI_26.3.05
which python         : /opt/homebrew/opt/python/libexec/bin/python
python version       : 3.15.2
which R              : /usr/local/bin/R
R version            : R version 4.6.2 (aarch64-apple-darwin23)

instances of various programs found in PATH:
    afni    : 1   (/Users/janeallendorfer/abin/afni)
    R       : 1   (/Library/Frameworks/R.framework/Versions/4.6/Resources/bin/R)
    python  : 1   (/opt/homebrew/Cellar/python@3.15/3.15.2/Frameworks/Python.framework/Versions/3.15/bin/python3.15)
    python2 : 0 
    python3 : 2 
      /opt/homebrew/Cellar/python@3.15/3.15.2/Frameworks/Python.framework/Versions/3.15/bin/python3.15
      /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 in dyn.load(ll) : 
          unable to load shared object '/Users/janeallendorfer/abin/R_io.so':
          dlopen(/Users/janeallendorfer/abin/R_io.so, 0x0006): tried: '/Users/janeallendorfer/abin/R_io.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/janeallendorfer/abin/R_io.so' (no such file), '/Users/janeallendorfer/abin/R_io.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64e.v1' or 'arm64' or 'arm64'))
        Calls: source ... withVisible -> eval -> eval -> set_R_io -> dyn.load
        Execution halted
    rPkgsInstall         : FAILURE
        Error in dyn.load(ll) : 
          unable to load shared object '/Users/janeallendorfer/abin/R_io.so':
          dlopen(/Users/janeallendorfer/abin/R_io.so, 0x0006): tried: '/Users/janeallendorfer/abin/R_io.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/janeallendorfer/abin/R_io.so' (no such file), '/Users/janeallendorfer/abin/R_io.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64e.v1' or 'arm64' or 'arm64'))
        Calls: source ... withVisible -> eval -> eval -> set_R_io -> dyn.load
        Execution halted

------------------------ 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
        Error in dyn.load(ll) : 
          unable to load shared object '/Users/janeallendorfer/abin/R_io.so':
          dlopen(/Users/janeallendorfer/abin/R_io.so, 0x0006): tried: '/Users/janeallendorfer/abin/R_io.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/janeallendorfer/abin/R_io.so' (no such file), '/Users/janeallendorfer/abin/R_io.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64e.v1' or 'arm64' or 'arm64'))
        Calls: source ... withVisible -> eval -> eval -> set_R_io -> dyn.load
        Execution halted

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 required

** failed to load module flask_cors
-- flask_cors is required

-------------------------------- env vars --------------------------------
PATH                       = /opt/homebrew/bin:/opt/homebrew/sbin:/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:/pkg/env/global/bin:/opt/X11/bin:/Library/Apple/usr/bin:/opt/homebrew/bin:/opt/homebrew/opt/python/libexec/bin:/Library/Frameworks/R.framework/Resources:/usr/local/gfortran/bin:/Users/janeallendorfer/abin:/opt/homebrew/opt/python/libexec/bin

PYTHONPATH                 = 
R_LIBS                     = /Users/janeallendorfer/sw/R-4.6.2
LD_LIBRARY_PATH            = 
DYLD_LIBRARY_PATH (sub-shell) = :/opt/X11/lib/flat_namespace
DYLD_FALLBACK_LIBRARY_PATH (sub-shell) = 
CONDA_SHLVL                = 
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 ----------

   -- considered operations: path, flatdir, apsearch
   
   -- note: followers should not need edits, so edit flags should be 0
      (have 0 follower(s), which can be ignored)
   
   no modifications needed across 1 dot files
   
------------------------------ data checks -------------------------------
data dir : found AFNI_data6   under $HOME (1902G Avail)
           history: 20 Feb 2020 [rickr]: updated FT_analysis examples
data dir : missing AFNI_data7
data dir : found AFNI_demos   under $HOME
           history: 29 Oct 2020 [taylorp]: updated scripts under FATCAT_DEM ...
data dir : found suma_demo    under $HOME
           history: Archive created by @PrepArchives in eomer.nimh.nih.gov  ...
data dir : found afni_handouts under $HOME
atlas    : found TT_N27+tlrc  under /Users/janeallendorfer/abin

------------------------------ OS specific -------------------------------
XQuartz version      : 2.8.6

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

which git            : /usr/bin/git
git version          : git version 2.50.1 (Apple Git-155)
which gcc            : /usr/bin/gcc
gcc version          : Apple clang version 21.0.0 (clang-2100.1.1.101)

brew gcc(s)          : /opt/homebrew/bin/gcc-16
CommandLineTools SDK : MacOSX26.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 'zsh'...
++ 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:/opt/X11/lib/flat_namespace

=========================  summary, please fix:  =========================
*  have ARM cpu, but Intel AFNI binaries
   - consider online install instructions for local build, or more directly:
     build_afni.py -build_root ~/afni_build -package macos_13_ARM
*  AFNI programs show FAILURE
*  missing R packages (see rPkgsInstall)
*  python library matplotlib is required
   (see AFNI install docs for details)
*  python library flask is required
*  python library flask_cors is required
*  insufficient data for AFNI bootcamp
   (see "Prepare for Bootcamp" on install pages)

janeallendorfer@NEURO-C61JHXTQ0L ~ % rPkgsInstall -pkgs ALL

oo Warning: 
   Failed to load R_io.so with this error message: 
 /Users/janeallendorfer/abin/R_io.so
Error in dyn.load(ll) : 
  unable to load shared object '/Users/janeallendorfer/abin/R_io.so':
  dlopen(/Users/janeallendorfer/abin/R_io.so, 0x0006): tried: '/Users/janeallendorfer/abin/R_io.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/janeallendorfer/abin/R_io.so' (no such file), '/Users/janeallendorfer/abin/R_io.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64e.v1' or 'arm64' or 'arm64'))
Calls: source ... withVisible -> eval -> eval -> set_R_io -> dyn.load
Execution halted
janeallendorfer@NEURO-C61JHXTQ0L ~ % R --version
R version 4.6.2 (2026-10-29) -- "Diversified Portfolio"
Copyright (C) 2026 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin23

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.

But when I run "R --version" I get

janeallendorfer@NEURO-C61JHXTQ0L abin % R --version
R version 4.6.2 (2026-10-29) -- "Diversified Portfolio"
Copyright (C) 2026 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin23

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.

Any help would be appreciated. So far, I have updated AFNI by completely reinstalling it per the NIH tool website, and have uninstalled any traces of R and reinstalled the latest and greatest from CRAN. I have updated all of brew and have made sure all environmental path statements are up to date.

Hello,

You are currently running the macos_12.12_local binaries, which are indeed build for Intel systems. Given that you used the NIH tool installer, it suggests that compiling failed. Try installing one of our precompiled packages first, to see if that works. Later, we can look into why compiling might not be working.

So please try this and see how it goes.

@update.afni.binaries -package macos_13_ARM

Since you are at NIH, please feel free to send me separate email, and we can meet to see why compiling is failing. I suspect it has to do with Apple's change to their CommandLineTools.

Either way, please let me know how the above command works for you.

Thanks,

-rick

I am not at NIH, but I was using the NIH website.

I did try adding "export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX26.5.sdk/" to the .zshrc file. THAT might fix the compiling issue, but I had not yet run the update command. Will report back.

Oh, cool. Yes, that is what I was going to try. Thanks a lot for letting us know!

-rick

Ok, after running the update command and then the check I get this:

janeallendorfer@NEURO-C61JHXTQ0L ~ % @update.afni.binaries -package macos_13_ARM
-- running @update.afni.binaries version 3.31, January 9, 2025
-- have AFNI binaries under /Users/janeallendorfer/abin
-- have current build label 'official'
++ updating build label from 'official' to 'official'
-- install dir: using existing /Users/janeallendorfer/abin
-- any downloads will be from https://afni.nimh.nih.gov via curl -O -f

-- attempting to install package macos_13_ARM under
   install dir: /Users/janeallendorfer/abin ...
-- have install dir
deleting old temporary directory...
++ working in new temp dir, .tmp.install
++ getting install prog: curl -O -f bin/misc/@update.afni.binaries ...
curl -O -f https://afni.nimh.nih.gov/pub/dist/bin/misc/@update.afni.binaries
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 62565  100 62565    0     0   357k      0 --:--:-- --:--:-- --:--:--  359k
-- fixing lost permissions on @update.afni.binaries
-- @update.afni.binaries is current, continuing with this version...
++ downloading test file: curl -O -f macos_13_ARM/afni ...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 12.1M  100 12.1M    0     0  9777k      0  0:00:01  0:00:01 --:--:-- 9785k

++ update needed, installing...

++ downloading full package: curl -O -f macos_13_ARM.tgz ...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  831M  100  831M    0     0  2831k      0  0:05:00  0:05:00 --:--:-- 2612k
++ extracting package macos_13_ARM.tgz...
++ syncing new binaries...
done, yay (binaries are under /Users/janeallendorfer/abin)
janeallendorfer@NEURO-C61JHXTQ0L ~ % afni_system_check.py -check_all            
-------------------------------- general ---------------------------------
architecture:         64bit Mach-O
cpu type:             arm64
system:               Darwin
release:              25.6.0
version:              Darwin Kernel Version 25.6.0: Tue Aug 18 17:49:13 PDT 2026; root:xnu-12377.161.15.700.19~2/RELEASE_ARM64_T6000
distribution:         26.7.1
number of CPUs:       10
user:                 janeallendorfer
apparent login shell: zsh
shell RC file:        .zshrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni           : /Users/janeallendorfer/abin/afni
afni version         : Precompiled binary macos_13_ARM: Oct 29 2026 
                     : AFNI_26.3.06 'Philip the Arab'
AFNI_version.txt     : AFNI_26.3.06, macos_13_ARM, Oct 29 2026, official
afnipy version       : AFNI_26.3.06
which python         : /opt/homebrew/opt/python/libexec/bin/python
python version       : 3.15.2
which R              : /usr/local/bin/R
R version            : R version 4.6.2 (aarch64-apple-darwin23)

instances of various programs found in PATH:
    afni    : 1   (/Users/janeallendorfer/abin/afni)
    R       : 1   (/Library/Frameworks/R.framework/Versions/4.6/Resources/bin/R)
    python  : 1   (/opt/homebrew/Cellar/python@3.15/3.15.2/Frameworks/Python.framework/Versions/3.15/bin/python3.15)
    python2 : 0 
    python3 : 2 
      /opt/homebrew/Cellar/python@3.15/3.15.2/Frameworks/Python.framework/Versions/3.15/bin/python3.15
      /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                : success
    rPkgsInstall         : success

------------------------ 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
        
        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: lme4!
        These packages are not installed on the computer: lmerTest!
        These packages are not installed on the computer: gamm4!
        These packages are not installed on the computer: paran!
        These packages are not installed on the computer: psych!
        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 : /Library/Frameworks/R.framework/Resources

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

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

** failed to load module flask
-- flask is required

** failed to load module flask_cors
-- flask_cors is required

-------------------------------- env vars --------------------------------
PATH                       = /opt/homebrew/bin:/opt/homebrew/sbin:/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:/pkg/env/global/bin:/opt/X11/bin:/Library/Apple/usr/bin:/opt/homebrew/bin:/opt/homebrew/opt/python/libexec/bin:/Library/Frameworks/R.framework/Resources:/usr/local/gfortran/bin:/Users/janeallendorfer/abin:/opt/homebrew/opt/python/libexec/bin

PYTHONPATH                 = 
R_LIBS                     = /Users/janeallendorfer/sw/R-4.6.2
LD_LIBRARY_PATH            = 
DYLD_LIBRARY_PATH (sub-shell) = :/opt/X11/lib/flat_namespace
DYLD_FALLBACK_LIBRARY_PATH (sub-shell) = 
CONDA_SHLVL                = 
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 ----------

   -- considered operations: path, apsearch
   
   -- note: followers should not need edits, so edit flags should be 0
      (have 0 follower(s), which can be ignored)
   
   no modifications needed across 1 dot files
   
------------------------------ data checks -------------------------------
data dir : found AFNI_data6   under $HOME (1902G Avail)
           history: 20 Feb 2020 [rickr]: updated FT_analysis examples
data dir : missing AFNI_data7
data dir : found AFNI_demos   under $HOME
           history: 29 Oct 2020 [taylorp]: updated scripts under FATCAT_DEM ...
data dir : found suma_demo    under $HOME
           history: Archive created by @PrepArchives in eomer.nimh.nih.gov  ...
data dir : found afni_handouts under $HOME
atlas    : found TT_N27+tlrc  under /Users/janeallendorfer/abin

------------------------------ OS specific -------------------------------
XQuartz version      : 2.8.6

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

which git            : /usr/bin/git
git version          : git version 2.50.1 (Apple Git-155)
which gcc            : /usr/bin/gcc
gcc version          : Apple clang version 21.0.0 (clang-2100.1.1.101)

brew gcc(s)          : /opt/homebrew/bin/gcc-16
CommandLineTools SDK : MacOSX26.5.sdk

=========================  summary, please fix:  =========================
*  missing R packages (see rPkgsInstall)
*  python library matplotlib is required
   (see AFNI install docs for details)
*  python library flask is required
*  python library flask_cors is required
*  insufficient data for AFNI bootcamp
   (see "Prepare for Bootcamp" on install pages)

Seems to be correct now I posted the previous dump for future users.

That's good to see.

Do you have any R library packages installed under your ~/sw/R-4.6.2 $R_LIBS directory? If you need to get those libraries, the next step would be to run:

rPkgsInstall -pkgs ALL

There is also the little conda setup for matplotlib and flask to consider.

Thanks,

-rick

I did not run the rPkgsInstall -pkgs ALL command yet. My wife (The real end user, I am just her IT guy) already tried to run her script to process. It started out by downloading a BUNCH of packages, so it may have already run the package installer. I'll report back later, but she reports that she has gotten good output so far!

That's great, thanks!

-rick