Installation of RODBC on OS X Yosemite
When installing the R package RODBC in RStudio on OS X Yosemite, I get the following error:
configure: error: "ODBC headers sql.h and sqlext.h not found"
This is a common error and indicates that ODBC drivers haven't been installed (iODBC headers aren't included in OS 10.9 hence the separate install required). So, I install unixODBC and confirm that the header files are present in the PATH.
Sys.getenv("PATH") gives me the correct path including where the two files are found.
However, when I try install.packages("RODBC",type = "source") again, the same error persists. Have tested this with iODBC as well as unixODBC.
Are there any other tests I can perform to help diagnose the issue?
We have a bunch of Yosemite systems with R 3.1.2 that are all up-to-date with Xcode & Xcode command-line tools. The following consistently works with each major R update or new system install (at the Terminal):
brew update && brew install unixODBC && \ wget "http://cran.r-project.org/src/contrib/RODBC_1.3-10.tar.gz" && \ R CMD INSTALL RODBC_1.3-10.tar.gz
It (obviously) requires Homebrew, but that's what we've standardized on in our shop.
As RODBC is updated, the version number (1.3-10, 1.3-11, ...) will change. To find out the current version, look at https://cran.r-project.org/web/packages/RODBC/index.html.
I got a 404 when calling RODBC_1.3-10.tar.gz so I made a tiny change to the script above and it worked perfectly: brew update && brew install unixODBC && wget "http://cran.r-project.org/src/contrib/RODBC_1.3-11.tar.gz" && R CMD INSTALL RODBC_1.3-11.tar.gz
I'm using OS X Yosemite 10.10.5, R version 3.2.2. By following below steps, I'm able to make it work.
- brew install unixodbc
- brew link unixodbc (if missing this step, R still can not find those header files)
- install.packages('RODBC', type='source')
On my OS X Yosemite system with unixODBC installed from MacPorts and R 3.3.2, install.packages() failed (whether from repo or from a tarball I had saved locally) but R CMD INSTALL RODBC_1.3-14.tar.gz did the job.