Skip to content

Commit 8fe8a55

Browse files
committed
Doc: improve directions for building on macOS.
In light of recent discussions, we should instruct people to install Apple's command line tools; installing Xcode is secondary. Also, fix sample command for finding out the default sysroot, as we now know that the command originally recommended can give a result that doesn't match your OS version. Also document the workaround to use if you really don't want configure to select a sysroot at all. Discussion: https://postgr.es/m/20210119111625.20435-1-james.hilliard1@gmail.com
1 parent 35a7eef commit 8fe8a55

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

doc/src/sgml/installation.sgml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2356,6 +2356,17 @@ make MAX_CONNECTIONS=5 check
23562356
<secondary>installation on</secondary>
23572357
</indexterm>
23582358

2359+
<para>
2360+
To build <productname>PostgreSQL</productname> from source
2361+
on <productname>macOS</productname>, you will need to install Apple's
2362+
command line developer tools, which can be done by issuing
2363+
<programlisting>
2364+
xcode-select --install
2365+
</programlisting>
2366+
(note that this will pop up a GUI dialog window for confirmation).
2367+
You may or may not wish to also install Xcode.
2368+
</para>
2369+
23592370
<para>
23602371
On recent <productname>macOS</productname> releases, it's necessary to
23612372
embed the <quote>sysroot</quote> path in the include switches used to
@@ -2372,7 +2383,7 @@ make PG_SYSROOT=<replaceable>/desired/path</replaceable> all
23722383
</programlisting>
23732384
To find out the appropriate path on your machine, run
23742385
<programlisting>
2375-
xcodebuild -version -sdk macosx Path
2386+
xcrun --show-sdk-path
23762387
</programlisting>
23772388
Note that building an extension using a different sysroot version than
23782389
was used to build the core server is not really recommended; in the
@@ -2386,6 +2397,19 @@ xcodebuild -version -sdk macosx Path
23862397
<programlisting>
23872398
./configure ... PG_SYSROOT=<replaceable>/desired/path</replaceable>
23882399
</programlisting>
2400+
This would primarily be useful to cross-compile for some other
2401+
macOS version. There is no guarantee that the resulting executables
2402+
will run on the current host.
2403+
</para>
2404+
2405+
<para>
2406+
To suppress the <option>-isysroot</option> options altogether, use
2407+
<programlisting>
2408+
./configure ... PG_SYSROOT=none
2409+
</programlisting>
2410+
(any nonexistent pathname will work). This might be useful if you wish
2411+
to build with a non-Apple compiler, but beware that that case is not
2412+
tested or supported by the PostgreSQL developers.
23892413
</para>
23902414

23912415
<para>

0 commit comments

Comments
 (0)