Postgresql Connection


I have RStudio Pro. I am having a problem to connect DigitalOcean Postgresql database with my M3 Max MacPro. I can use the exact same setting in my M1 MacBook and connect without a problem. I have two problems.

  1. When I use Connections, PostgreSQL installs the driver but gives me and an error in a popup window: "installation failed". The Postgresql driver is not registered.
  2. And I cannot connect manually
con <- dbConnect(odbc::odbc(),
+                  Driver = "PostgreSQL",
+                  Database = db_name,
+                  UID = db_user,
+                  PWD = db_password,
+                  Server = db_host,
+                  Port = db_port,
+                  sslmode = "require")

Gives me an error: Error: nanodbc/nanodbc.cpp:1138: 00000
[unixODBC][Driver Manager]Can't open lib 'PostgreSQL Server' : file not found

I know that


[1] name attribute value
<0 rows> (or 0-length row.names)

After digging little more, I see that I have every thing set up correctly

odbcinst -j
unixODBC 2.3.11
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
USER DATA SOURCES..: /Users/YigitAydede/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8

cat /etc/odbcinst.ini
Driver = /opt/homebrew/lib/

cd /opt/homebrew/lib
cmake libmpdec++.4.dylib
engines-3 libmpdec++.a
gettext libmpdec++.dylib
libasprintf.0.dylib libmpdec.4.0.0.dylib
libasprintf.a libmpdec.4.dylib
libasprintf.dylib libmpdec.a
libcrypto.3.dylib libmpdec.dylib
libcrypto.a libodbc.2.dylib
libcrypto.dylib libodbc.a
libgettextlib-0.22.4.dylib libodbc.dylib
libgettextlib.a libodbccr.2.dylib
libgettextlib.dylib libodbccr.a
libgettextpo.0.dylib libodbccr.dylib
libgettextpo.a libodbcinst.2.dylib
libgettextpo.dylib libodbcinst.a
libgettextsrc-0.22.4.dylib libodbcinst.dylib
libgettextsrc.a libssl.3.dylib
libgettextsrc.dylib libssl.a
libintl.8.dylib libssl.dylib
libintl.a libtextstyle.0.dylib
libintl.dylib libtextstyle.a
libltdl.7.dylib libtextstyle.dylib
libltdl.a libzstd.1.5.5.dylib
libltdl.dylib libzstd.1.dylib
liblz4.1.9.4.dylib libzstd.a
liblz4.1.dylib libzstd.dylib
liblz4.a ossl-modules
liblz4.dylib pkgconfig
liblzma.dylib python3.11

This works on my M! machine but not in my new M3 Max.
I appreciate any help


Solved the issue: I added ODBCSYSINI=/etc into my .Renviron file. After restarted RStudio, now it works. Thanks to Brian Destine in odbcListDrivers does not show list · Issue #341 · r-dbi/odbc · GitHub

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.