The two operating systems do share a lot of code, for example most userland utilities and the C library on macOS are derived from FreeBSD versions.