

# macOS

Choose a workgroup and authentication method, and grant the connection credentials `athena:GetWorkGroup`. For a DuckDB connection, use a DuckDB workgroup and leave `EngineVersion` unset for the initial connection.

## Install
<a name="odbc-v4-driver-macos-install"></a>

Use the platform installer for your client computer and configure the installed driver with your ODBC driver manager.

Open the `AmazonAthenaODBC-4.0.0.0-macos11-universal.pkg` package and follow the installer. Check the installed package receipts with `pkgutil`.

```bash
pkgutil --pkgs | grep athena.odbc
```

## Configure the driver and DSN
<a name="odbc-v4-driver-macos-configure"></a>

The installed examples are in `/opt/amazon/athena-odbc/share/athena-odbc`. Copy `odbc.ini.example` and `odbcinst.ini.example` into your configuration directory and remove the `.example` suffix.

```bash
sudo mkdir -p /opt/amazon/athena-odbc/etc/athena-odbc
sudo cp /opt/amazon/athena-odbc/share/athena-odbc/odbc.ini.example /opt/amazon/athena-odbc/etc/athena-odbc/odbc.ini
sudo cp /opt/amazon/athena-odbc/share/athena-odbc/odbcinst.ini.example /opt/amazon/athena-odbc/etc/athena-odbc/odbcinst.ini
```

Configure `odbcinst.ini` with the registered driver name and installed library path.

```
[ODBC Drivers]
Amazon Athena ODBC (x64)=Installed

[Amazon Athena ODBC (x64)]
Driver=/opt/amazon/athena-odbc/lib/libathenaodbc.dylib
Setup=/opt/amazon/athena-odbc/lib/libathenaodbc.dylib
```

Configure `odbc.ini` with your DSN. Replace the Region, workgroup, and database in the following example; this connection uses the default credentials provider chain.

```
[ODBC Data Sources]
athena_odbc_test=Amazon Athena ODBC (x64)

[athena_odbc_test]
Driver=/opt/amazon/athena-odbc/lib/libathenaodbc.dylib
AwsRegion=us-west-2
Workgroup=my-duckdb-workgroup
Catalog=AwsDataCatalog
Schema=my_database
AuthenticationType=Default Credentials
ResultFetcher=auto
```

For iODBC, set `ODBCINI` to your DSN configuration file and `ODBCINSTINI` to the driver configuration file.

```bash
export ODBCINI=/opt/amazon/athena-odbc/etc/athena-odbc/odbc.ini
export ODBCINSTINI=/opt/amazon/athena-odbc/etc/athena-odbc/odbcinst.ini
```

## Test the connection
<a name="odbc-v4-driver-macos-test"></a>

Run the iODBC `iodbctest` program. At the connection-string prompt, enter `DSN=athena_odbc_test;`. After connecting, submit a query such as `SELECT 1`.

```bash
iodbctest
```