What does set -a do?

In most POSIX‐style shells (bash, zsh, etc.), including the ones you’ll find on macOS, set can be used to turn various shell options on or off.

A common use-case is when you have a plain text file of variable assignments:

That way everything defined in my-env-file.sh ends up in your environment without having to prefix each line with export.