s2geometry for Mac
This is a package for manipulating geometric shapes. Unlike many geometry libraries, S2 is primarily designed to work with spherical geometry, i.e., shapes drawn on a sphere rather than on a planar 2D map.
s2geometry — overview
S2 Geometry Library
Overview
This is a package for manipulating geometric shapes. Unlike many geometry libraries, S2 is primarily designed to work with _spherical geometry_, i.e., shapes drawn on a sphere rather than on a planar 2D map. This makes it especially suitable for working with geographic data.
If you want to learn more about the library, start by reading the overview and quick start document, then read the introduction to the basic types.
S2 documentation can be found on s2geometry.io.
API/ABI Stability
Note that all releases are version 0.x, so there are no API or ABI stability guarantees. Starting with 1.0 we will adhere to SemVer and follow the
The Python API is particularly unstable, and it is planned that the SWIGged API will be replaced by a pybind11 version with more Pythonic names and more complete functionality.
Requirements for End Users using Bazel
Build
This bazel build requires Bazel 8 or newer. Builds were tested using C++20 as set in .bazelrc. This setup relies on abseil-cpp and googletest from the bazel central repository as set in MODULE.bazel.
To build and test using bazel, from within s2geometry/src, run:
bazel test "//:"
To build the libary without testing, from within s2geometry/src, run:
bazel build //:s2
Status
All tests enumerated in the BUILD.bazel file pass on x86 machines. On Apple M1, s2loop_measures_test fails due to a 6% excess accumlated error. This issue may require revision of boringssl or exactfloat.
Requirements for End Users using CMake
We aim to support all platforms supported by the
CMake >= 3.22 A C++ compiler with C++17 support, such as g++ >= 7.5 or
Abseil LTS
(standard library extensions). This exact version must be used. googletest testing framework >= 1.10 (to build tests and example programs, optional) OpenSSL (for its bignum library)
On Ubuntu, all of these other than abseil can be installed via apt-get:
abseil-cpp may need to be installed from source if an LTS release is not packaged for the platform. See the use of -DCMAKE_PREFIX_PATH in the build instructions below.
On macOS, use MacPorts or Homebrew. For MacPorts:
Build and Install
You may either download the source as a ZIP archive, or clone the git repository.
Via ZIP archive
Download ZIP file
Via git clone
Building
First, install Abseil. It must be configured with -DCMAKE_POSITION_INDEPENDENT_CODE=ON. s2geometry must be configured to use the same C++ version that abseil uses. The easiest way to achieve this is to pass -DCMAKE_CXX_STANDARD=17 to cmake when compiling both abseil and s2geometry.
From the appropriate directory depending on how you got the source:
On macOS, sysctl -n hw.logicalcpu is the equivalent of nproc.
Disable building of shared libraries with -DBUILD_SHARED_LIBS=OFF.
Enable the python interface with -DWITH_PYTHON=ON.
For Testing
If BUILD_TESTS is 'on' (the default), then OpenSSL must be available to build some tests:
OpenSSL (for its bignum library)
Details
球体上的计算几何与空间索引
How to install s2geometry
- Open Terminal (press ⌘ + Space and type “Terminal”).
- If Homebrew is not installed yet, run the command below first.
- Run this command:
Latest 10 releases
Last updated 2026-04-23; current version v0.14.0, with the latest 10 releases listed.
| Version | Released | Type | Size | macOS | Windows | Linux |
|---|---|---|---|---|---|---|
| v0.14.0 | 2026-04-23 | Stable | — | — | — | — |
| v0.13.1 | 2025-12-03 | Stable | — | — | — | — |
| v0.13.0 | 2025-12-01 | Stable | — | — | — | — |
| v0.12.0 | 2025-02-17 | Stable | — | — | — | — |
| v0.11.1 | 2024-02-03 | Stable | — | — | — | — |
| v0.11.0 | 2024-01-27 | Stable | — | — | — | — |
| v0.10.0 | 2022-04-08 | Stable | — | — | — | — |
| v0.9.0 | 2019-03-05 | Stable | — | — | — | — |
| v0.10.0-2022.02.23.00 | 2022-02-23 | Pre-release | — | — | — | — |
| v0.9.0-2019.03.04.00 | 2019-03-04 | Pre-release | — | — | — | — |
Data from GitHub Releases; stable releases first, each group sorted newest first.
Prebuilt bottle platforms
Official Homebrew bottles cover:
- Apple silicon · latest macOS
- Apple silicon · macOS 26 Tahoe
- Apple silicon · macOS 15 Sequoia
- Apple silicon · macOS 14 Sonoma
- Intel · macOS 14 Sonoma
- Linux · ARM64
- Linux · x86_64
Compared with similar apps
Only public metadata is compared, with no subjective recommendation; see the compare pages for field-by-field comparisons.
| App | Version | License | Architecture | 30-day installs |
|---|---|---|---|---|
| s2geometry | v0.14.0 | Apache-2.0 | CLI | 4 |
| h3 | v4.5.0 | Apache-2.0 | CLI | 8 |
| ngt | v2.8.1 | Apache-2.0 | CLI | 1 |
| tile38 | 1.38.0 | MIT | CLI | 3 |
Similar apps: Command-line Tools
h3
Hexagonal hierarchical geospatial indexing systemngt
Neighborhood Graph and Tree for Indexing High-dimensional Datatile38
In-memory geolocation data store, spatial index, and realtime geofenceopencsg
OpenCSG is a constructive solid geometry (CSG) rendering library invoked via the command line.manifold
C++ Documentation | ManifoldCAD User Guide | JS/TS/WASM API | Algorithm Documentation | Blog…openssl@4
Cryptography and SSL/TLS ToolkitCategories: Command-line Tools