The following instructions improve on those here by avoiding the need to:
a. Compile the Homebrew binary itself b. Set the path for the Homebrew binary
- Install HomeBrew using the
.pkg
file available here. - Get the
mssql-release
files by running the following command in Terminal:
/opt/homebrew/bin/brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
- Install the driver by running the following command in Terminal:
HOMEBREW_ACCEPT_EULA=Y /opt/homebrew/bin/brew install msodbcsql18 mssql-tools18
- Install the R package
odbc
by runninginstall.packages("odbc")
at the R console in RStudio. - Access the database:
library(DBI)
db <- dbConnect(odbc::odbc(),
Driver = "/opt/homebrew/lib/libmsodbcsql.18.dylib",
Server = "xxx.database.windows.net",
Database = "database",
UID = "user",
PWD = "password")