Use macbook to cancel ambient noise I don't own noise-cancelling headphones, but I do own a macbook (which has a microphone) and a pair of headphones.

Is there a way for me to use this set-up (some macOS app or such) to cancel noise in the same way active noise-cancelling headphones do?
In short, no.

The measurement required to provide correct phase-cancellation in a headset is measured in microns, not inches.
You could neither measure it accurately enough nor stay still enough for it to work.
You would also suffer so much throughput latency in hard &amp; software that any attempt at correction would arrive far too late to be of any use.

Some people seem to object to my definition of the precision required for this to be effective.
Let's add more to that. 

Not only do you need your distances to be accurate for the gap between mic &amp; speaker, but you also need to be feeding the resultant audio back at the correct phase with regard to the speaker/mic orientation.
If you are trying to do this using a mic oriented at approximately 90° to the headphone speakers, assuming you are facing the computer, your chances of success are even smaller.

You then need to decide which phase you are going to send to which ear. Are you going to guess at an approximation of the 90° &amp; then flip one by 180° compared to the other?

Does that better explain why these systems are measured in microns, not inches? It has little to do with the wavelength at any given frequency &amp; more to do with the orientation of your phase... otherwise you are just as likely to reinforce the wave as to cancel it.