Cant Install Packages in Rstudio

Hello,
I am having trouble installing binary packages on Rstudio, I receive the same results everytime I try and install:

" Warning in install.packages :
error in running command
Warning in install.packages :
'tar' returned non-zero exit code 127
Error in install.packages : file ‘/var/folders/35/83hw3y1s5sb6z767cl_9kb280000gn/T//RtmpEhWotM/downloaded_packages/cli_3.4.1.tgz’ is not a macOS binary package"

R is R 4.2.1 GUI 1.79 Big Sur ARM build (8095)
Rstudio 2022.07.2 Build 576
I am using Mac mini Chip Apple M1 / MacOS Monetary version 12.5/

Note that I can install package through R app , but not R studio.

Thank you for your help.

Please show the complete console output when you try to install a package from RStudio, such as

install.packages("cli")
Installing package into ‘/Users/john/Library/R/arm64/4.2/library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/macosx/big-sur-arm64/contrib/4.2/cli_3.4.1.tgz'
Content type 'application/x-gzip' length 1292969 bytes (1.2 MB)
==================================================
downloaded 1.2 MB

The downloaded binary packages are in
/var/folders/pf/6d__jj8s2xx662h3sr98nc280000gp/T//RtmpCOdjcX/downloaded_packages

install.packages("dslabs")
also installing the dependencies ‘cli’, ‘colorspace’, ‘utf8’, ‘farver’, ‘labeling’, ‘lifecycle’, ‘munsell’, ‘R6’, ‘RColorBrewer’, ‘viridisLite’, ‘fansi’, ‘magrittr’, ‘pillar’, ‘pkgconfig’, ‘vctrs’, ‘digest’, ‘glue’, ‘gtable’, ‘isoband’, ‘rlang’, ‘scales’, ‘tibble’, ‘withr’, ‘ggplot2’

trying URL 'http://cran.rstudio.com/bin/macosx/big-sur-arm64/contrib/4.2/cli_3.4.1.tgz'
Content type 'application/x-gzip' length 1292969 bytes (1.2 MB)

downloaded 1.2 MB

trying URL 'http://cran.rstudio.com/bin/macosx/big-sur-arm64/contrib/4.2/colorspace_2.0-3.tgz'
Content type 'application/x-gzip' length 2622583 bytes (2.5 MB)

downloaded 2.5 MB

sh: tar: command not found
Warning in install.packages :
error in running command
Warning in install.packages :
'tar' returned non-zero exit code 127
Error in install.packages : file ‘/var/folders/35/83hw3y1s5sb6z767cl_9kb280000gn/T//RtmpEhWotM/downloaded_packages/cli_3.4.1.tgz’ is not a macOS binary package

library(dslabs)
Error in library(dslabs) : there is no package called ‘dslabs’

Sorry, this one is outside of my expertise. I have never had the "sh: tar: command not found" or "not a macOS binary package" error with either Intel or Apple M1 processors. Best of luck!!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.