Skip to main content

Installing HDDS on macOS

This guide covers building HDDS from source on macOS.

Tested platforms

macOS: tested natively on macOS 14 (x86_64), Apple Silicon not yet tested. Linux is the tested platform.

There is no Homebrew formula and no installer package: HDDS is built from the repository, as on Linux. The shared-memory transport is Linux-only: on macOS, participants use UDP.

Prerequisites​

  • Xcode Command Line Tools: xcode-select --install
  • A recent stable Rust (install via rustup). Rust 1.89 or later is needed for the workspace build (cargo build --release at the root), because the dependency rusqlite 0.41.1 requires it
  • Git
  • CMake 3.16 or later (for the C++ SDK): brew install cmake
# Install Xcode Command Line Tools
xcode-select --install

# Install Rust (if not already installed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/env

# Verify Rust version
rustc --version # 1.89 or later for the workspace build

Clone and Build​

# Clone the repository
git clone https://git.hdds.io/hdds/hdds.git
cd hdds

# Build in release mode
cargo build --release

# Run the library tests to verify
cargo test -p hdds --lib

The suite binds UDP ports, so run it on an otherwise quiet machine, and re-run a failing module on its own before concluding that the code is at fault.

C, Python and TypeScript SDKs

cargo build --release at the repository root also builds crates/rmw-hdds, which links the ROS 2 middleware crate into the C library. If you intend to use the C, Python or TypeScript SDK, run cargo build --release -p hdds-c after any workspace-wide build, because a workspace build leaves libhdds_c with undefined ROS 2 symbols.

Using HDDS in Your Project​

Add HDDS from crates.io:

cargo add hdds

Or declare it in your project's Cargo.toml:

[dependencies]
hdds = "1.5.0"

With optional features:

[dependencies]
hdds = { version = "1.5.0", features = ["security"] }

To build against a checkout instead of the published crate, for example to test a change that is not released yet, use a path dependency:

[dependencies]
hdds = { path = "/path/to/hdds/crates/hdds" }

Optional Features​

FeatureDescription
securityDDS Security 1.1 plugins (HDDS-to-HDDS)
tcp-tlsTLS encryption for TCP transport
quicQUIC transport
cloud-discoveryAWS / Azure / Consul discovery (preview)
k8sKubernetes DNS-based discovery
rpcDDS-RPC Request/Reply
telemetryMetrics collection

The default features are xtypes, qos-loaders and xtypes-structural-assignability. The full list is in crates/hdds/Cargo.toml.

Code Generator (hddsgen)​

HDDS 1.5 needs hddsgen 2.0 or later. The generator lives in its own repository:

git clone https://git.hdds.io/hdds/hdds_gen.git
cargo install --path hdds_gen

# Put ~/.cargo/bin on PATH if it is not already there
export PATH="$HOME/.cargo/bin:$PATH"

# Verify: must print hddsgen 2.0.0 or later
hddsgen --version

C and C++ Development​

Build the C library, which produces libhdds_c.dylib and libhdds_c.a in target/release/:

cargo build --release -p hdds-c

The public header is sdk/c/include/hdds.h. To install the header, the libraries, a pkg-config file and the CMake config into a prefix:

make install-c PREFIX=$HOME/.local

Compile a C program against the installed prefix:

export PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig
clang -o myapp myapp.c $(pkg-config --cflags --libs hdds_c)
DYLD_LIBRARY_PATH=$HOME/.local/lib ./myapp

C++ SDK​

make sdk-cxx builds the C++ wrappers on top of the C library. Its recipe calls nproc, which macOS does not ship: install it with brew install coreutils (it is installed as gnproc, so create an nproc alias or symlink), or build by hand:

cargo build --release -p hdds-c
cd sdk/cxx
cmake -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF
cmake --build build

CMake Integration​

cmake_minimum_required(VERSION 3.16)
project(myapp CXX)
set(CMAKE_CXX_STANDARD 17)

find_package(hdds REQUIRED)

add_executable(myapp main.cpp)
target_link_libraries(myapp PRIVATE hdds::hdds)
# CMAKE_PREFIX_PATH tells CMake where to find hdds-config.cmake
# (shipped in sdk/cmake/ of the repository)
cmake .. -DCMAKE_PREFIX_PATH=/path/to/hdds/sdk/cmake

Python Installation​

The Python SDK is a pure-Python ctypes package built from this repository; it is not on PyPI. Build the native library and the wheel as described in Build from source, then point the loader at the library:

cargo build --release -p hdds-c                # target/release/libhdds_c.dylib
cd sdk/python
python3 -m pip install "setuptools>=77" # the SDK build needs setuptools 77 or newer
python3 -m pip wheel --no-build-isolation --no-deps --no-index -w dist .
python3 -m pip install --no-index dist/hdds-*-py3-none-any.whl
export HDDS_LIB_PATH=/path/to/hdds/target/release

# Verify
python3 -c "import hdds; print(hdds.library_path(), hdds.__version__)"

Verify Installation​

Run the Hello World sample (two terminals). Its types are generated by hddsgen, see the Quick Start in the repository README.md:

sdk/samples/scripts/generate.sh
cd sdk/samples/01_basics/rust
cargo run --bin hello_world # Terminal 1: subscriber
cargo run --bin hello_world -- pub # Terminal 2: publisher

If the subscriber receives nothing, read Network Prerequisites: on one machine, run both terminals with HDDS_INTERFACE=lo0 (macOS names the loopback interface lo0).

macOS-Specific Configuration​

Firewall​

The macOS application firewall may block incoming DDS traffic. Allow it:

  1. Open System Settings -> Network -> Firewall
  2. Click Options
  3. Add your application or allow incoming connections

Or via command line:

# Disable firewall for testing (not recommended for production)
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off

Multicast​

Discovery uses UDP multicast. Check the multicast route:

# Check multicast route
netstat -rn | grep 239

# If missing, add route
sudo route add -net 239.255.0.0/16 -interface en0

If a VPN is active, multicast can be captured by its tunnel: see Network Prerequisites.

Sleep Prevention​

For long-running DDS applications:

# Prevent sleep while app runs
caffeinate -i ./my_dds_app

Troubleshooting​

"Library not loaded" Error​

# Point the dynamic loader at the directory holding libhdds_c.dylib
export DYLD_LIBRARY_PATH=/path/to/hdds/target/release:$DYLD_LIBRARY_PATH

Multicast Not Working​

# Check interface multicast capability
ifconfig en0 | grep MULTICAST

# Check firewall
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --listapps

Next Steps​