Skip to content

R install on silicon Mac lacks long.double capability

6 messages · Naresh Gurbuxani, Duncan Murdoch, Simon Urbanek +1 more

#
On my new macbook pro, I installed R using package installer R-4.5.1-arm64.pkg
My installation lacks long.double and libxml capabilities.  How can these be enabled?

My installation was in two steps:
1.  Install Xcode developer tools (sudo xcode-select install), GNU fortran compiler (gfortran-14.2-universal.pkg at cran), gnu readline, liblzma, and pcre2 (using macports), texlive, and Xquartz.  Install R using above package installer.
2.  Source install.R from https://mac.r-project.org/bin/.  In sudo R session, run install.libs("r-base-dev").  Reinstall R using above package installer.
jpeg         png        tiff       tcltk         X11        aqua
       TRUE        TRUE        TRUE        TRUE        TRUE        TRUE
   http/ftp     sockets      libxml        fifo      cledit       iconv
       TRUE        TRUE       FALSE        TRUE        TRUE        TRUE
        NLS       Rprof     profmem       cairo         ICU long.double
       TRUE        TRUE        TRUE        TRUE        TRUE       FALSE
    libcurl
       TRUE
R version 4.5.1 (2025-06-13)
Platform: aarch64-apple-darwin20
Running under: macOS Sequoia 15.4.1

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.1

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/New_York
tzcode source: internal

attached base packages:
[1] stats     graphics  utils     datasets  grDevices methods   base

other attached packages:
[1] latticeExtra_0.6-31 lattice_0.22-7      colorspace_2.1-2

loaded via a namespace (and not attached):
[1] compiler_4.5.1     deldir_2.0-4       RColorBrewer_1.1-3 Rcpp_1.1.0
[5] interp_1.1-6       jpeg_0.1-11        grid_4.5.1         png_0.1-8
nareshgurbuxani$ gfortran --version
GNU Fortran (GCC) 14.2.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
You will have to rebuild it from source with compilers that support 
those items.  I'm not sure why libxml is missing, but long.double is 
missing because the Apple silicon doesn't natively support it, and the 
compiler that R Core uses doesn't emulate it, or the emulation it offers 
is not worth using.

Maybe someone more knowledgeable than me can tell you whether this is 
feasible or not.  I trust Simon's decisions, so I'm pretty sure it's not 
desirable.

Duncan Murdoch
On 2025-10-23 5:35 p.m., Naresh Gurbuxani wrote:
#
Naresh,

Both of those can only be FALSE by definition:

1) arm64 hardware (Apple Silicon, i.e M1,2,3,4) has no support for long doubles, so you cannot enable that one.

2) libxml is always FALSE since 4.2.0 - see ?capabilities:

  libxml: is there support for integrating ?libxml? with the R event loop?  ?TRUE? as from R 3.3.0, ?FALSE? as from R 4.2.0.

Cheers,
Simon

PS: what you described in "My installation was in two steps? has no effect on R or its capabilities. Those steps are only required if you want to compile R yourself (or re-compile some packages).
#
Naresh:


May I ask the application that requires long.double?


Might it make sense to revise the algorithm of the application to get 
enhanced precision without long.doubles?


EXAMPLE: Ordinary least squares regression to estimate b in Y = X b + e 
as b-hat = inverse(X'X) = X'Y. However, computing it that way discards 
half of the precision. To see that, we write X as its singular value 
decomposition UDV'. Then X'X = V D^2 V' and X'Y = V D Y. Then 
inverse(X'X) = inverse(V') inverse(D)^-2 inverse(V) %*% V D U' Y. If you 
compute that way, you throw away half of the precision of D. You can 
avoid that by computing inverse(V') inverse(D) U' Y.


This computation is more commonly done using the QR decomposition, where 
the loss of numeric precision is equivalent but not as obvious.


???
Please excuse if I have once again exposed my infinite ignorance. 
Spencer Graves
On 10/23/25 17:27, Simon Urbanek wrote:
#
Simon,

Thanks for clarifying.??

I applaud R community for going the extra mile.? While I did not ask about libxml, both Duncan and Simon noted capabilities() output and commented on it.??

Naresh
________________________________________
From:?Simon Urbanek <simon.urbanek at R-project.org>
Sent:?Thursday, October 23, 2025 6:27 PM
To:?Naresh Gurbuxani <naresh_gurbuxani at hotmail.com>
Cc:?r-sig-mac at r-project.org <r-sig-mac at r-project.org>
Subject:?Re: [R-SIG-Mac] R install on silicon Mac lacks long.double capability
?
Naresh,

Both of those can only be FALSE by definition:

1) arm64 hardware (Apple Silicon, i.e M1,2,3,4) has no support for long doubles, so you cannot enable that one.

2) libxml is always FALSE since 4.2.0 - see ?capabilities:

? libxml: is there support for integrating ?libxml? with the R event loop?? ?TRUE? as from R 3.3.0, ?FALSE? as from R 4.2.0.

Cheers,
Simon

PS: what you described in "My installation was in two steps? has no effect on R or its capabilities. Those steps are only required if you want to compile R yourself (or re-compile some packages).
#
Spencer,

I wanted to verify that I have properly installed R.  I was not specifically looking for long double.

Thanks,
Naresh
Sent from my iPhone