Skip to content

Commit

Permalink
macOS: Add tabs for Homebrew/MacPorts and for 3.13+/3.11-3.12/3.8-3.10 (
Browse files Browse the repository at this point in the history
python#1317)

Co-authored-by: Erlend E. Aasland <[email protected]>
Co-authored-by: Ezio Melotti <[email protected]>
  • Loading branch information
3 people authored May 9, 2024
1 parent 0c56002 commit 84b8813
Showing 1 changed file with 43 additions and 33 deletions.
76 changes: 43 additions & 33 deletions getting-started/setup-building.rst
Original file line number Diff line number Diff line change
Expand Up @@ -690,54 +690,64 @@ on Linux, macOS and iOS.
manager, like Homebrew_ or MacPorts_, and then add the appropriate paths
for the header and library files to your ``configure`` command.

For example, with **Homebrew**, install the dependencies::
.. tab:: Homebrew

$ brew install pkg-config [email protected] xz gdbm tcl-tk mpdecimal
For **Homebrew**, install dependencies using ``brew``::

Then, for Python 3.13 and newer, run ``configure``::
$ brew install pkg-config [email protected] xz gdbm tcl-tk mpdecimal

$ GDBM_CFLAGS="-I$(brew --prefix gdbm)/include" \
GDBM_LIBS="-L$(brew --prefix gdbm)/lib -lgdbm" \
./configure --with-pydebug \
--with-system-libmpdec \
--with-openssl="$(brew --prefix [email protected])"
.. tab:: Python 3.13+

For Python 3.11 and 3.12::
For Python 3.13 and newer::

$ GDBM_CFLAGS="-I$(brew --prefix gdbm)/include" \
GDBM_LIBS="-L$(brew --prefix gdbm)/lib -lgdbm" \
./configure --with-pydebug \
--with-openssl="$(brew --prefix [email protected])"
$ GDBM_CFLAGS="-I$(brew --prefix gdbm)/include" \
GDBM_LIBS="-L$(brew --prefix gdbm)/lib -lgdbm" \
./configure --with-pydebug \
--with-system-libmpdec \
--with-openssl="$(brew --prefix [email protected])"

Or, for Python 3.8 through 3.10::
.. tab:: Python 3.11-3.12

$ 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 [email protected])" \
--with-tcltk-libs="$(pkg-config --libs tcl tk)" \
--with-tcltk-includes="$(pkg-config --cflags tcl tk)"
For Python 3.11 and 3.12::

And finally, run ``make``::
$ GDBM_CFLAGS="-I$(brew --prefix gdbm)/include" \
GDBM_LIBS="-L$(brew --prefix gdbm)/lib -lgdbm" \
./configure --with-pydebug \
--with-openssl="$(brew --prefix [email protected])"

$ make -s -j2
.. tab:: Python 3.8-3.10

For Python 3.8, 3.9, and 3.10::

$ 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 [email protected])" \
--with-tcltk-libs="$(pkg-config --libs tcl tk)" \
--with-tcltk-includes="$(pkg-config --cflags tcl tk)"

.. tab:: MacPorts

For **MacPorts**, install dependencies using ``port``::

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

Alternatively, with **MacPorts**::
.. tab:: Python 3.13+

$ sudo port install pkgconfig openssl xz gdbm tcl tk +quartz mpdecimal
For Python 3.13 and newer::

Then, for Python 3.13 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-system-libmpdec

$ GDBM_CFLAGS="-I$(dirname $(dirname $(which port)))/include" \
GDBM_LIBS="-L$(dirname $(dirname $(which port)))/lib -lgdbm" \
./configure --with-pydebug \
--with-system-libmpdec
.. tab:: Python 3.11-3.12

Or, for Python 3.11 and 3.12, run ``configure``::
For Python 3.11 and 3.12::

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

And finally, run ``make``::

Expand Down

0 comments on commit 84b8813

Please sign in to comment.