Skip to content

Commit 2cdce1e

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 175f716 commit 2cdce1e

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
@@ -2523,6 +2523,17 @@ PHSS_30849 s700_800 u2comp/be/plugin library Patch
25232523
<secondary>installation on</secondary>
25242524
</indexterm>
25252525

2526+
<para>
2527+
To build <productname>PostgreSQL</productname> from source
2528+
on <productname>macOS</productname>, you will need to install Apple's
2529+
command line developer tools, which can be done by issuing
2530+
<programlisting>
2531+
xcode-select --install
2532+
</programlisting>
2533+
(note that this will pop up a GUI dialog window for confirmation).
2534+
You may or may not wish to also install Xcode.
2535+
</para>
2536+
25262537
<para>
25272538
On recent <productname>macOS</productname> releases, it's necessary to
25282539
embed the <quote>sysroot</quote> path in the include switches used to
@@ -2539,7 +2550,7 @@ make PG_SYSROOT=<replaceable>/desired/path</replaceable> all
25392550
</programlisting>
25402551
To find out the appropriate path on your machine, run
25412552
<programlisting>
2542-
xcodebuild -version -sdk macosx Path
2553+
xcrun --show-sdk-path
25432554
</programlisting>
25442555
Note that building an extension using a different sysroot version than
25452556
was used to build the core server is not really recommended; in the
@@ -2553,6 +2564,19 @@ xcodebuild -version -sdk macosx Path
25532564
<programlisting>
25542565
./configure ... PG_SYSROOT=<replaceable>/desired/path</replaceable>
25552566
</programlisting>
2567+
This would primarily be useful to cross-compile for some other
2568+
macOS version. There is no guarantee that the resulting executables
2569+
will run on the current host.
2570+
</para>
2571+
2572+
<para>
2573+
To suppress the <option>-isysroot</option> options altogether, use
2574+
<programlisting>
2575+
./configure ... PG_SYSROOT=none
2576+
</programlisting>
2577+
(any nonexistent pathname will work). This might be useful if you wish
2578+
to build with a non-Apple compiler, but beware that that case is not
2579+
tested or supported by the PostgreSQL developers.
25562580
</para>
25572581

25582582
<para>

0 commit comments

Comments
 (0)