Skip to content
43 changes: 25 additions & 18 deletions getting-started/setup-building.rst
Original file line number Diff line number Diff line change
Expand Up @@ -419,46 +419,53 @@ For example, with **Homebrew**, install the dependencies::

$ brew install pkg-config openssl@1.1 xz gdbm tcl-tk

Then, for Python 3.10 and newer, run ``configure``::
Then, for Python 3.11 and newer, run ``configure``::
Comment thread
erlend-aasland marked this conversation as resolved.
Resolved

$ CFLAGS="-I$(brew --prefix gdbm)/include -I$(brew --prefix xz)/include" \
LDFLAGS="-L$(brew --prefix gdbm)/lib -I$(brew --prefix xz)/lib" \
PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig" \
$ GDBM_CFLAGS="-I$(brew --prefix gdbm)/include" \
GDBM_LIBS="-L$(brew --prefix gdbm)/lib -lgdbm" \
./configure --with-pydebug \
--with-openssl="$(brew --prefix openssl@1.1)"

Or, for Python 3.7 through 3.10::

Or, for Python 3.7 through 3.9::

$ export PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig"; \
CFLAGS="-I$(brew --prefix gdbm)/include -I$(brew --prefix xz)/include" \
$ CPPFLAGS="-I$(brew --prefix gdbm)/include -I$(brew --prefix xz)/include" \
LDFLAGS="-L$(brew --prefix gdbm)/lib -L$(brew --prefix xz)/lib" \
./configure --with-pydebug \
--with-openssl="$(brew --prefix openssl@1.1)" \
--with-tcltk-libs="$(pkg-config --libs tcl tk)" \
--with-tcltk-includes="$(pkg-config --cflags tcl tk)"
--with-openssl="$(brew --prefix openssl@1.1)" \
--with-tcltk-libs="$(pkg-config --libs tcl tk)" \
--with-tcltk-includes="$(pkg-config --cflags tcl tk)"

And finally, run ``make``::

$ make -s -j2

Alternatively, with **MacPorts**::

$ sudo port install pkgconfig openssl xz gdbm
$ sudo port install pkgconfig openssl11 xz gdbm tcl tk +quartz

Then, for Python 3.11 and newer, run ``configure``::

$ GDBM_CFLAGS="-I$(dirname $(dirname $(which port)))/include" \
GDBM_LIBS="-L$(dirname $(dirname $(which port)))/lib -lgdbm" \
./configure --with-pydebug \
--with-openssl="$(dirname $(dirname $(which port)))/libexec/openssl11"

and ``configure``::
Or, for Python 3.7 through 3.10::

$ CPPFLAGS="-I/opt/local/include" \
LDFLAGS="-L/opt/local/lib" \
./configure --with-pydebug
$ CPPFLAGS="-I$(dirname $(dirname $(which port)))/include" \
LDFLAGS="-L$(dirname $(dirname $(which port)))/lib" \
./configure --with-pydebug \
--with-openssl="$(dirname $(dirname $(which port)))/libexec/openssl11" \
--with-tcltk-libs="$(pkg-config --libs tcl tk)" \
--with-tcltk-includes="$(pkg-config --cflags tcl tk)"

and ``make``::
And finally, run ``make``::

$ make -s -j2

There will sometimes be optional modules added for a new release which
won't yet be identified in the OS-level build dependencies. In those cases,
just ask for assistance on the core-mentorship list.
just ask for assistance in the *Core Development* category on :ref:`help-discourse`.

Explaining how to build optional dependencies on a Unix-based system without
root access is beyond the scope of this guide.
Expand Down