FactorminerR ERROR with R studio 4.1.2

I am trying to install FactormineR in Rstudio version 4.1.2 and it gives me an error.
Can somebody help me?

library(FactoMineR)
library(Factoshiny)
Loading required package: shiny
Loading required package: FactoInvestigate
Loading required package: ggplot2
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Error: package or namespace load failed for ‘Factoshiny’:
.onLoad failed in loadNamespace() for 'tcltk', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/tcltk/libs/tcltk.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/tcltk/libs/tcltk.so, 0x000A): Library not loaded: /opt/X11/lib/libX11.6.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/tcltk/libs/tcltk.so
Reason: tried: '/opt/X11/lib/libX11.6.dylib' (no such file), '/usr/lib/libX11.6.dylib' (no such file)
In addition: Warning message:
In system2("/usr/bin/otool", c("-L", shQuote(DSO)), stdout = TRUE) :
running command ''/usr/bin/otool' -L '/Library/Frameworks/R.framework/Resources/library/tcltk/libs//tcltk.so'' had status 1

Thanks!!!

Mac OS X

The core software development utilities required for R package development can be obtained by installing the Command Line Tools for XCode. You can do this in one of two ways. Either:

  1. Download and install XCode from the Mac AppStore: ‎Xcode on the Mac App Store
  2. Within XCode go to Preferences : Downloads and install the Command Line Tools

Thanks for answer nirgrahamuk
step 1. OK
step 2. Sorry but I don't know what do I have to do here....

I'm steel trying
I have this message from RStudio:
The downloaded binary packages are in
/var/folders/dp/3lw9m0997xj_sz1chd1v5qr00000gn/T//Rtmp5cf5Bz/downloaded_packages

install.packages("FactoMineR_2.4.tgz")
Warning in install.packages :
package ‘FactoMineR_2.4.tgz’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

Assuming you installed Xcode via the step 1 which I think you indicated. Then in R do.

install.packages('Factoshiny')

hello,
thanks for the answer and the help. I'm starting in R and I hope I'm still alive
finally I was able to run it from the Rcommander and after installing the XQUARTS (I couldn't do it with the mac app) and consulting on the web, I have succeeded!