I found the solution on the internet, but I'm writing it here in case it occurs again in the future:
I couldn't install hisafer after having upgraded the OS: I got the warning "tar: Failed to set default locale" and and error (converted from warning) about failure to set locale (sorry I didn't copy the exact error message).
This solved the problem:
system("defaults write org.R-project.R force.LANG en_US.UTF-8")
then restart the computer
I found the solution on the internet, but I'm writing it here in case it occurs again in the future: I couldn't install hisafer after having upgraded the OS: I got the warning "tar: Failed to set default locale" and and error (converted from warning) about failure to set locale (sorry I didn't copy the exact error message). This solved the problem: system("defaults write org.R-project.R force.LANG en_US.UTF-8") then restart the computer