Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Follow these steps to configure the locale for R on macOS M1:

  1. Open the Terminal app on your Mac.
  2. Type the following command and press enter:

    sudo nano /etc/locale.gen
    
  3. Type your password if prompted and press enter.

  4. This will open a file in the nano text editor. Find the line that starts with "#en_US.UTF-8" and remove the "#" symbol to uncomment the line.
  5. Save the changes by pressing "Control" and "O" and then press enter.
  6. Exit the nano editor by pressing "Control" and "X".
  7. Type the following command and press enter to generate the new locale:

    sudo locale-gen
    
  8. Type the following command and press enter to update the system’s locale:

    sudo update-locale LANG=en_US.UTF-8
    
  9. Close the terminal app and restart your computer for the changes to take effect.

  10. Open R and check that the locale has been set correctly by typing the following command in the console:

    Sys.getlocale()
    

This should return "en_US.UTF-8" indicating that the locale has been set correctly.