Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 29ba005

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 878cf60 commit 29ba005

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
@@ -2215,6 +2215,17 @@ make MAX_CONNECTIONS=5 check
22152215
<secondary>installation on</secondary>
22162216
</indexterm>
22172217

2218+
<para>
2219+
To build <productname>PostgreSQL</productname> from source
2220+
on <productname>macOS</productname>, you will need to install Apple's
2221+
command line developer tools, which can be done by issuing
2222+
<programlisting>
2223+
xcode-select --install
2224+
</programlisting>
2225+
(note that this will pop up a GUI dialog window for confirmation).
2226+
You may or may not wish to also install Xcode.
2227+
</para>
2228+
22182229
<para>
22192230
On recent <productname>macOS</productname> releases, it's necessary to
22202231
embed the <quote>sysroot</quote> path in the include switches used to
@@ -2231,7 +2242,7 @@ make PG_SYSROOT=<replaceable>/desired/path</replaceable> all
22312242
</programlisting>
22322243
To find out the appropriate path on your machine, run
22332244
<programlisting>
2234-
xcodebuild -version -sdk macosx Path
2245+
xcrun --show-sdk-path
22352246
</programlisting>
22362247
Note that building an extension using a different sysroot version than
22372248
was used to build the core server is not really recommended; in the
@@ -2245,6 +2256,19 @@ xcodebuild -version -sdk macosx Path
22452256
<programlisting>
22462257
./configure ... PG_SYSROOT=<replaceable>/desired/path</replaceable>
22472258
</programlisting>
2259+
This would primarily be useful to cross-compile for some other
2260+
macOS version. There is no guarantee that the resulting executables
2261+
will run on the current host.
2262+
</para>
2263+
2264+
<para>
2265+
To suppress the <option>-isysroot</option> options altogether, use
2266+
<programlisting>
2267+
./configure ... PG_SYSROOT=none
2268+
</programlisting>
2269+
(any nonexistent pathname will work). This might be useful if you wish
2270+
to build with a non-Apple compiler, but beware that that case is not
2271+
tested or supported by the PostgreSQL developers.
22482272
</para>
22492273

22502274
<para>

0 commit comments

Comments
 (0)