I have a similar problem. See the output below at startup install.packages("gdtools").
* installing *source* package ‘gdtools ...
** package ‘gdtools successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=
Using PKG_LIBS=-L/usr/local/Cellar/cairo/1.16.0/lib -lcairo
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because cairo was not found. Try installing:
* deb: libcairo2-dev (Debian, Ubuntu)
* rpm: cairo-devel (Fedora, CentOS, RHEL)
* csw: libcairo_dev (Solaris)
* brew: cairo (OSX)
If cairo is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a cairo.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘gdtools
* removing ‘/usr/local/lib/R/3.5/site-library/gdtools
And here is my conclusion brew config:
HOMEBREW_VERSION: 2.0.4
ORIGIN: https://github.com/Homebrew/brew
HEAD: 0f07fe5c5cdfdf0f424bba7b879faa38aedc8ee4
Last commit: 21 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 07d6a7b951c6992fd8cae3f917510ef81aefef33
Core tap last commit: 2 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.1jkVuIO8bN/org.macosforge.xquartz:0
HOMEBREW_LOGS: /Users/swvanderlaan/Library/Logs/Homebrew
CPU: quad-core 64-bit skylake
Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 10.0 build 1000
Git: 2.21.0 => /usr/local/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 11.0.2
macOS: 10.14.3-x86_64
CLT: 10.1.0.0.1.1539992718
Xcode: 10.1
CLT headers: 10.1.0.0.1.1539992718
XQuartz: 2.7.11 => /opt/X11
It looks like I have XQuartz, Xcode, and CLT installed correctly. If I run, brew info cairoI get this:
cairo: stable 1.16.0 (bottled), HEAD
Vector graphics library with cross-device output support
https://cairographics.org/
/usr/local/Cellar/cairo/1.16.0 (117 files, 5.5MB) *
Poured from bottle on 2019-03-12 at 10:36:28
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/cairo.rb
==> Dependencies
Build: pkg-config ✔
Required: fontconfig ✔, freetype ✔, glib ✔, libpng ✔, pixman ✔
==> Options
Install HEAD version
==> Analytics
install: 83,081 (30 days), 202,883 (90 days), 583,774 (365 days)
install_on_request: 5,671 (30 days), 16,812 (90 days), 66,295 (365 days)
build_error: 0 (30 days)
, : gdtools , cairo.