I can´t install packages on R studio, "non-zero exit status"

Hi, and welcome.

For future reference, please see FAQ: What's a reproducible example (`reprex`) and how do I do one?, although it's not needed for your problem.

I see you're on MAC OS, and there is an alignment of problems today.

R package come in two flavors: binary and source. Saint Simon Urbanek of the R Core Development Team, does the occasionally heavy lifting to get the source code to successfully compile. Whenever it's an option, this is the way to go.

Unfortunately, the CRAN repository had a very rare glitch, and the mirrors all reflected it. It will be shortly fixed, but in the meantime

 install.packages("tidyverse", repo = 'https://mac.R-project.org')

should work.

But sometimes, you run into a situation where you need a package for which no source version has yet been prepared. This can get dicey.

First, you need to download and install the free XCode app from the App Store.

Second, from the terminal, you need to run the command

$ xcode-select --install

Now, you can perhaps compile from source. Short programs usually succeed, unless they have uninstalled dependencies, which can be fixed with other tools, but it's an intermediate to advanced process. Some programs won't compile even if you do have the required dependencies, because they use codes that Apple's compiler doesn't play well with To fix that problem, you have to edit the source code.

R users like me, who are basically interested in using R, rather than programming the R plumbing don't want to spend their time re-coding even if they can.