macOS
LaTeX on macOS
MacTeX is TeX Live with a native Mac installer, so there is no shell work here.
Install MacTeX
Runs on Intel and Apple silicon, and needs macOS 11 Big Sur or newer. When it finishes, everything is configured. BasicTeX is the same distribution cut down to about 140 MB, with packages added later using tlmgr.
MacTeX installs TeX Live Utility in /Applications/TeX. Use it to keep the distribution updated.
If latexmk comes back "not found"
Open a new Terminal window, and quit and reopen Texpile, before deciding something is wrong.
If it is still missing, re-run the MacTeX installer, or open TeX Live Utility and use its repair option.