Fix #5937.

This removes the dependence on `which` and just requires `curl`.