I'm having the same problem but I've installed Clang 6.0.0 and GNU Fortran 6.1, so I'm hoping to get a better solution. Also need to note that it's looking to access gcc/7.2.0 and I have version 9.2.0_1.
My error looks like this:
> install.packages("rJava", type = "source")
trying URL 'https://cran.rstudio.com/src/contrib/rJava_0.9-11.tar.gz'
Content type 'application/x-gzip' length 675188 bytes (659 KB)
==================================================
downloaded 659 KB
* installing *source* package ‘rJava’ ...
** package ‘rJava’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gcc... /usr/local/Cellar/gcc/7.2.0/bin/gcc-7
checking whether the C compiler works... no
configure: error: in `/private/var/folders/27/rm0ty0c95p58_hbvcr6n38m40000gq/T/RtmpuHU4bp/R.INSTALL25375b87a773/rJava':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘rJava’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava’
Warning in install.packages :
installation of package ‘rJava’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/27/rm0ty0c95p58_hbvcr6n38m40000gq/T/Rtmp1s9HDC/downloaded_packages’