Skip to content

Commit 4dd2c3b

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 cbcf7b1 commit 4dd2c3b

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

doc/src/sgml/installation.sgml

+25-1
Original file line numberDiff line numberDiff line change
@@ -2549,6 +2549,17 @@ PHSS_30849 s700_800 u2comp/be/plugin library Patch
25492549
<secondary>installation on</secondary>
25502550
</indexterm>
25512551

2552+
<para>
2553+
To build <productname>PostgreSQL</productname> from source
2554+
on <productname>macOS</productname>, you will need to install Apple's
2555+
command line developer tools, which can be done by issuing
2556+
<programlisting>
2557+
xcode-select --install
2558+
</programlisting>
2559+
(note that this will pop up a GUI dialog window for confirmation).
2560+
You may or may not wish to also install Xcode.
2561+
</para>
2562+
25522563
<para>
25532564
On recent <productname>macOS</productname> releases, it's necessary to
25542565
embed the <quote>sysroot</quote> path in the include switches used to
@@ -2565,7 +2576,7 @@ make PG_SYSROOT=<replaceable>/desired/path</replaceable> all
25652576
</programlisting>
25662577
To find out the appropriate path on your machine, run
25672578
<programlisting>
2568-
xcodebuild -version -sdk macosx Path
2579+
xcrun --show-sdk-path
25692580
</programlisting>
25702581
Note that building an extension using a different sysroot version than
25712582
was used to build the core server is not really recommended; in the
@@ -2579,6 +2590,19 @@ xcodebuild -version -sdk macosx Path
25792590
<programlisting>
25802591
./configure ... PG_SYSROOT=<replaceable>/desired/path</replaceable>
25812592
</programlisting>
2593+
This would primarily be useful to cross-compile for some other
2594+
macOS version. There is no guarantee that the resulting executables
2595+
will run on the current host.
2596+
</para>
2597+
2598+
<para>
2599+
To suppress the <option>-isysroot</option> options altogether, use
2600+
<programlisting>
2601+
./configure ... PG_SYSROOT=none
2602+
</programlisting>
2603+
(any nonexistent pathname will work). This might be useful if you wish
2604+
to build with a non-Apple compiler, but beware that that case is not
2605+
tested or supported by the PostgreSQL developers.
25822606
</para>
25832607

25842608
<para>

0 commit comments

Comments
 (0)