I am trying to create a new folder in the main directory
Tried all kinds of examples
sudo mkdir /data/db
sudo mkdir -p /data/db<
Mac version Catalina made the root folder is no longer writable.
Brew has an updated version of mongodb to use a new path (which it creates itself), /usr/local/var/mongodb and following these instructions will fix the issue:
Guide to installing updated mongodb-community-edition
brew install mongodb-community@VERSION where the first VERSION with the fix is 4.2