I am having issues on installing R packages in R studio. I have updated all my R and R studio and Mac version! It is Mac Sonoma with Intel. The error message i got:
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/6h/6_3mc0f97ksds4kp7c783yvc0000gn/T//RtmpWr7INZ/downloaded_packages/fansi_1.0.5.tgz’ is not a macOS binary package.
I have checked with ChatGPT and tried its suggestion and it did not worked out. Does anyone have the same problem and have some solutions to suggest?
Hi Gabor,
Thanks for your reply. R version is R 4.3.2 and i installed the way is is suggested by Posit. How to customize the PATH? That is not clear to me.
And i have tried your suggestions and here are the output:
Sys.which("tar")
tar
""
Sys.getenv("PATH")
[1] "[[ -r /usr/local/etc/profile.d/bash_completion.sh ]] && . /usr/local/etc/pro$:/Users/seherfazlioglu/Applications/quarto/bin:/Library/TeX/texbin:/usr/texbin:/Applications/RStudio.app/Contents/Resources/app/quarto/bin:/Applications/RStudio.app/Contents/Resources/app/bin/postback"
Sys.setenv(TAR="internal")
install.packages("fansi")
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/6h/6_3mc0f97ksds4kp7c783yvc0000gn/T//RtmpCwFeYK/downloaded_packages/fansi_1.0.5.tgz’ is not a macOS binary package.
Thanks for your suggestions. I downloaded R via this website, https://cran.rstudio.com for Mac OS, then downloaded Rstudio. Please find the outputs for your questions below:
Setting PATH has worked. I have no error message, but got this one: "The downloaded binary packages are in
/var/folders/6h/6_3mc0f97ksds4kp7c783yvc0000gn/T//RtmpPEXEvM/downloaded_packages". Secondly, for packages there are user library and system library sections.
Do you think it is ok and i can work with this setup?
Best
Seher
> writeLines(readLines("~/.Renviron"))
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
cannot open file '/Users/seherfazlioglu/.Renviron': No such file or directory.
Anacoda makes things more complicated. Or i changed the set-up in wrong direction. What is next for now?
Ah, you are using anaconda. In general, then you have two choices:
deactivate conda while using "regular R", or
installing R from anaconda
(RStudio is fine with anaconda R on macOS, AFAIR.)
As for the messed up PATH, it seems like some anaconda startup file messes it up. Maybe a bug in anaconda, I don't know. Or you copy-pasted something and that was messed up. The
I have tried to install R via Anaconda, but it failed. I had better start to fix the PATH as you suggested.
I have been searching in the web, could not find clear instructions. Do you have any suggestions on how to reset origional PATH? and do you think that it is ok to do so( e.g. not corrupting any other packages).