1# How to build iODBC for Mac OS X
2
3    Copyright (C) 1996-2021 OpenLink Software <iodbc@openlinksw.com>
4
5## Method 1: Using Project builder
6
7This build method only works for Xcode 8.0 or newer.
8
9This version of Xcode was first supported on macOS 10.11 El Capitan, however the resulting binaries
10are backward compatible with OS X 10.9 Mavericks and newer.
11
12OpenLink uses build environments on macOS 10.14 Mojave and macOS 11 Big Sur to build suitable
13notarized installers with graphical components.
14
15You first need to install the latest Mac OS X Developer Packages, which can be found at:
16
17    http://developer.apple.com/tools
18
19Then execute the following commands from a terminal session to build all the frameworks and demo applications:
20
21    $ cd mac
22    $ make
23
24
25After building the iODBC libraries and applications, you have to install them on your system with the command:
26
27    $ sudo make install
28
29This installs the iODBCinst and iODBC frameworks into:
30
31    /Library/Frameworks/iODBC.framework
32    /Library/Frameworks/iODBCinst.framework
33
34and the test applications iodbctest and iodbctestw into:
35
36    /Library/Application Support/iODBC/bin
37
38and the iODBC Administrator and the iODBC Demo applications in:
39
40    /Applications/iODBC
41
42
43### iODBC Administrator
44Now that you have installed the iODBC frameworks on your system, you are able to use ODBC applications or build your own
45applications using the iODBC API.
46
47Once you have installed an ODBC Driver, you can configure a new ODBC DSN using either the 32bit Cocoa UI which can configure
48and test any ODBC driver that is build in universal mode:
49
50  /Applications/iODBC/iODBC Administrator.app
51
52or the 64bit version which can configure drivers that only support a 64bit Cocoa UI:
53
54     /Applications/iODBC/iODBC Administrator64.app
55
56### Test DSN connection
57Once you have configured a DSN, you will be able to make a connection using the iodbctest command which is located in:
58
59    /Library/Application Support/iODBC/bin/iodbctest
60
61
62
63## Method 2: Using configure and make
64The iODBC package can also be build like any other Open Source package not using any frameworks.
65
66This build method still works with older versions of Xcode.
67
68On OS X 10.10 Yosemite and newer, Apple removed a number of programs from their Xcode.app commandline installation including
69the autoconf, automake, libtool, and some other tools needed to build iODBC from a newly checked out GIT tree. We suggest
70using the [HomeBrew package manager](http://brew.sh/) to install these tools.
71
72To build the libraries, open up a terminal session and execute the following commands:
73
74    $ sh autogen.sh
75    $ ./configure
76    $ make
77
78To install the header files and libraries in /usr/local, you execute the following command as administrator:
79
80    $ sudo make install
81
82Note that this will build all code based that only runs on the CPU type you build it on, so PowerPC on older systems, 32bit
83Intel on early CoreDuo machine and 64bit on current models.
84
85However iODBC can also be configured to build a universal library that works with all 3 models embedded.
86
87
88### Mac OS X 10.5 and 10.6
89The following commands will build a release of iODBC that works on both Mac OS X 10.5 as well as Mac OS X 10.6:
90
91    $ CFLAGS="-O -arch ppc -arch i386 -arch x86_64"
92    $ CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX10.5.sdk"
93    $ CFLAGS="$CFLAGS -mmacosx-version-min=10.5"
94    $ export CFLAGS
95
96    $ sh autogen.sh
97    $ ./configure \
98	--disable-dependency-tracking \
99	--prefix=/usr/local/iODBC.universal
100
101    $ make
102    $ sudo make install
103
104
105### Mac OS X 10.7 Lion and Mac OS X 10.8 Mountain Lion
106The following commands will build a release of iODBC that works on Mac OS X 10.7 and 10.8:
107
108    $ CFLAGS="-O -arch i386 -arch x86_64"
109    $ CFLAGS="$CFLAGS -mmacosx-version-min=10.7"
110    $ export CFLAGS
111
112    $ sh autogen.sh
113    $ ./configure \
114	--disable-dependency-tracking \
115	--prefix=/usr/local/iODBC.universal
116
117    $ make
118    $ sudo make install
119
120
121### OS X 10.9 Maveriks through macOS 10.15 Catalina
122The following commands will build a release of iODBC that works on OS X 10.9 and newer:
123
124    $ CFLAGS="-O -arch i386 -arch x86_64"
125    $ CFLAGS="$CFLAGS -mmacosx-version-min=10.9"
126    $ export CFLAGS
127
128    $ sh autogen.sh
129    $ ./configure \
130	--disable-dependency-tracking \
131	--prefix=/usr/local/iODBC.universal
132
133    $ make
134    $ sudo make install
135
136
137### macOS 11 Big Sur including Apple Silicon support
138The following commands will build a release of iODBC that works on OS X 11 Big Sur:
139
140    $ CFLAGS="-O -arch arm64 -arch x86_64"
141    $ CFLAGS="$CFLAGS -mmacosx-version-min=10.9"
142    $ export CFLAGS
143
144    $ sh autogen.sh
145    $ ./configure \
146	--disable-dependency-tracking \
147	--prefix=/usr/local/iODBC.universal
148
149    $ make
150    $ sudo make install
151
152
153### Test DSN connection
154Once you have installed an ODBC driver and configured a DSN, you will be able to make a connection using the iodbctest
155command which is located in:
156
157    /usr/local/iODBC.universal/bin/iodbctest
158