Cannot set locale in Rstudio

## --- The problem: ---

I'm trying to run Rstudio, but whenever I start up I see these messages:



During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C" 
2: Setting LC_COLLATE failed, using "C" 
3: Setting LC_TIME failed, using "C" 
4: Setting LC_MONETARY failed, using "C" 



Which I guess I could ignore, but when I try to install packages I get this :

tar: Failed to set default locale


so there's lots of things that I actually can't do now and to use R I guess I need to set the locale.


# --- What I've tried: ---

Based on suggestions I've seen in other forums, I've tried the following:


(from within R)

> Sys.setlocale("LC_ALL","English")


(from terminal)

$ defaults write org.R-project.R force.LANG en_US.UTF-8


(added to .bash_profile/.bashrc/pretty much anything else I could think of )

export LC_ALL="en_US.UTF-8"
export LANG="en_US.UTF-8"


None of the above resolved the problem, nor made any difference as far as I could tell.


# --- More info: ---

I'm using a macbook M1, OS Monterey. I used to use `R` via homebrew but as I have heard there are issues with that route, I've uninstalled that and installed system `R` from cran (this doesn't appear to make any difference) From the session, I get the following locale info:


> Sys.getlocale()
[1] "C/C/C/C/C/en_US.UTF-8"


I have no idea what's with all the extra `C/`'s , but I'd like to stick to US english UTF-8.



> sessionInfo()
R version 4.2.3 (2023-03-15)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.6.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib

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

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

loaded via a namespace (and not attached):
[1] compiler_4.2.3 tools_4.2.3  


Any help would be much appreciated. I've never had any of these issues on linux machines, and have no idea where this is coming from.

MacBook Pro 14″, macOS 12.6

Posted on Apr 4, 2023 7:09 AM

Reply

Similar questions

There are no replies.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Cannot set locale in Rstudio

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.