Installing Drupal module requires ftp access - macOS localhost
Depending on how you are running this locally (native, Docker, etc) this can differ, but I will assume you are using what comes with macOS to run Drupal.
The difference here is Mac does not have a www-data or apache user like Linux does. If you are running with the defaults, the user you are looking for is _www (unless you have modified this in Apache confs).
So, you will want to do:
chown _www (directory)

Technically, this is probably better asked on ServerFault, but I can imagine there are a lot of people trialling or demoing Drupal who just use what is on Mac to do it, and will come across this post finding it helpful.