Skip to content

Commit baf9fc4

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 a5f7b83 commit baf9fc4

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
@@ -2477,6 +2477,17 @@ PHSS_30849 s700_800 u2comp/be/plugin library Patch
24772477
<secondary>installation on</secondary>
24782478
</indexterm>
24792479

2480+
<para>
2481+
To build <productname>PostgreSQL</productname> from source
2482+
on <productname>macOS</productname>, you will need to install Apple's
2483+
command line developer tools, which can be done by issuing
2484+
<programlisting>
2485+
xcode-select --install
2486+
</programlisting>
2487+
(note that this will pop up a GUI dialog window for confirmation).
2488+
You may or may not wish to also install Xcode.
2489+
</para>
2490+
24802491
<para>
24812492
On recent <productname>macOS</productname> releases, it's necessary to
24822493
embed the <quote>sysroot</quote> path in the include switches used to
@@ -2493,7 +2504,7 @@ make PG_SYSROOT=<replaceable>/desired/path</replaceable> all
24932504
</programlisting>
24942505
To find out the appropriate path on your machine, run
24952506
<programlisting>
2496-
xcodebuild -version -sdk macosx Path
2507+
xcrun --show-sdk-path
24972508
</programlisting>
24982509
Note that building an extension using a different sysroot version than
24992510
was used to build the core server is not really recommended; in the
@@ -2507,6 +2518,19 @@ xcodebuild -version -sdk macosx Path
25072518
<programlisting>
25082519
./configure ... PG_SYSROOT=<replaceable>/desired/path</replaceable>
25092520
</programlisting>
2521+
This would primarily be useful to cross-compile for some other
2522+
macOS version. There is no guarantee that the resulting executables
2523+
will run on the current host.
2524+
</para>
2525+
2526+
<para>
2527+
To suppress the <option>-isysroot</option> options altogether, use
2528+
<programlisting>
2529+
./configure ... PG_SYSROOT=none
2530+
</programlisting>
2531+
(any nonexistent pathname will work). This might be useful if you wish
2532+
to build with a non-Apple compiler, but beware that that case is not
2533+
tested or supported by the PostgreSQL developers.
25102534
</para>
25112535

25122536
<para>

0 commit comments

Comments
 (0)