Just run dev/docker/run.sh and you will have a Linux environment with all that is needed to build ZooKeeper, even on MacOs.
dev/docker/run.sh