Use env shebangs for pre-installed gems. Closes #2167.