# OpenWebSpider on macOS

OpenWebSpider builds on macOS with Apple's command line tools plus Homebrew
dependencies. The macOS build uses `pkg-config`/`pkgconf`; when Homebrew is
available it also adds the common Apple Silicon and Intel package config paths
used by `mariadb-connector-c`, `openssl@3`, and `zlib`.

## Dependencies

Install Apple's compiler tools:

```bash
xcode-select --install
```

Install Homebrew packages:

```bash
brew install mariadb-connector-c openssl zlib pkgconf poppler ffmpeg
```

`poppler` provides `pdftotext` and `pdfinfo`; `ffmpeg` provides `ffprobe`.
Keep all Homebrew packages for the same architecture: Apple Silicon should be
all `arm64`, Intel should be all `x86_64`.

## Build

Build the core and modules:

```bash
make macos
```

The Makefile uses the platform default `cc`, which is Apple's Clang when the
command line tools are installed. Override it only if you intentionally want a
different compiler:

```bash
make macos CC=clang
```

To bring up the port in smaller steps, build only the crawler first:

```bash
make core
```

The macOS module outputs use `.dylib`, for example:

```bash
./openwebspider -f modules/mod_pdf/mod_pdf.dylib
./openwebspider -f modules/mod_image/mod_image.dylib
./openwebspider -f modules/mod_video/mod_video.dylib
```

The module files keep the project `.dylib` extension, but are linked as macOS
loadable bundles with dynamic lookup so plugin symbols can be resolved at load
time in the same way the Linux `.so` build works.

## Notes

The default module configs call `pdftotext`, `pdfinfo`, and `ffprobe` through
`PATH`, which works with Homebrew on both `/opt/homebrew/bin` and
`/usr/local/bin`.

If headers or libraries are not found, check:

```bash
pkg-config --cflags libmariadb
pkg-config --libs libmariadb
pkg-config --cflags openssl
pkg-config --libs openssl
```

If Homebrew is installed in a custom prefix, export `PKG_CONFIG_PATH` before
building or pass it inline:

```bash
PKG_CONFIG_PATH="/custom/prefix/lib/pkgconfig" make macos
```
