I am trying to install the RMariaDB package (on macOS), but install.packages("RMariaDB") fails with the following message:
-----------------------------[ ANTICONF ]-----------------------------
Configure could not find suitable mysql/mariadb client library. Try installing:
* deb: libmariadb-dev (Debian, Ubuntu)
* rpm: mariadb-connector-c-devel | mariadb-devel | mysql-devel (Fedora, CentOS, RHEL)
* csw: mysql56_dev (Solaris)
* brew: mariadb-connector-c (OSX)
If you already have a mysql client library installed, verify that either
mariadb_config or mysql_config is on your PATH. If these are unavailable
you can also set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------[ ERROR MESSAGE ]----------------------------
<stdin>:1:10: fatal error: 'mysql.h' file not found
#include <mysql.h>
^~~~~~~~~
1 error generated.
-----------------------------------------------------------------------
I'm confused because I've installed both mariadb-connector-c and mysql-connector-c++ using brew install, and added the directories containing each mariadb_config and mysql_config to my PATH:
~ % echo $PATH | tr ':' '\n'
/usr/local/mysql-9.1.0-macos14-x86_64/bin
/usr/local/Cellar/mariadb-connector-c/3.4.3/bin
/usr/local/opt/mariadb-connector-c/bin
[TRUNCATED...]
~ % mariadb_config
Copyright 2011-2020 MariaDB Corporation AB
Get compiler flags for using the MariaDB Connector/C.
Usage: mariadb_config [OPTIONS]
Compiler: Clang 16.0.0.16000026
[TRUNCATED...]
~ % mysql_config
Usage: /usr/local/mysql-9.1.0-macos14-x86_64/bin/mysql_config [OPTIONS]
Compiler: AppleClang 15.0.0.15000100
[TRUNCATED...]
Why can't mariadb_config or mysql_config be found despite being on my PATH?
I have noticed the hint you can also set INCLUDE_DIR and LIB_DIR manually via: R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...', but I don't know what to enter for ....
I am on R 4.4.2 and macOS 14.6.1:
R.Version()[c("platform", "version.string")]
#> $platform
#> [1] "x86_64-apple-darwin23.6.0"
#>
#> $version.string
#> [1] "R version 4.4.2 (2024-10-31)"
And here is the full output from install.packages("RMariaDB"):
Installing package into ‘/usr/local/lib/R/4.4/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/RMariaDB_1.3.3.tar.gz'
Content type 'application/x-gzip' length 910240 bytes (888 KB)
==================================================
downloaded 888 KB
* installing *source* package ‘RMariaDB’ ...
** package ‘RMariaDB’ successfully unpacked and MD5 sums checked
** using staged installation
Homebrew 4.4.15
Using PKG_CFLAGS=
Using PKG_LIBS=-lmysqlclient
Using PKG_PLOGR=
-----------------------------[ ANTICONF ]-----------------------------
Configure could not find suitable mysql/mariadb client library. Try installing:
* deb: libmariadb-dev (Debian, Ubuntu)
* rpm: mariadb-connector-c-devel | mariadb-devel | mysql-devel (Fedora, CentOS, RHEL)
* csw: mysql56_dev (Solaris)
* brew: mariadb-connector-c (OSX)
If you already have a mysql client library installed, verify that either
mariadb_config or mysql_config is on your PATH. If these are unavailable
you can also set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------[ ERROR MESSAGE ]----------------------------
<stdin>:1:10: fatal error: 'mysql.h' file not found
#include <mysql.h>
^~~~~~~~~
1 error generated.
-----------------------------------------------------------------------
ERROR: configuration failed for package ‘RMariaDB’
* removing ‘/usr/local/lib/R/4.4/site-library/RMariaDB’
Warning in install.packages :
installation of package ‘RMariaDB’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/r0/g_153g5n41n_rcdb3dkv72940000gq/T/RtmpfDfDGC/downloaded_packages’