The best thing to do when wanting to securely erase a Mac which uses a hard drive is to first enable Filevault and let Filevault finish encrypting the drive. Once the drive is encrypted, then a simple erase is enough to destroy the Filevault encryption keys preventing access to any data on the drive.
It is possible to write zeroes to the hard drive using the Terminal command line utility "dd".
If you only have an SSD and TRIM is enabled (the default for an Apple SSD), then just erasing the SSD using Disk Utility is enough to have the SSD zeroed out immediately because all the blocks on the SSD have been marked deleted and TRIM resets those unused blocks to zeroes.
There is a way to utilize the built-in hardware secure erase feature of hard drives and many SSDs, but this requires a Linux boot disk and Linux utility to access this hardware feature of the drives. If you perform the other steps I mentioned here your data will be unrecoverable.