The name of the IORegistry port property is not consistent across macOS versions: it's port on some, usb-port-number on others. (Run ioreg -c AppleUSB30HubPort or ioreg -c AppleUSB20HubPort to show the properties on your Mac.)
get_device_port in os/darwin_usb.c should pass kUSBHostPortPropertyPortNumber rather than "port" to get_ioregistry_value_data. This makes libusb_get_port_numbers return port numbers on all recent versions of macOS.