diff -u -r ../ruby-2.4.0/lib/rubygems/installer.rb ./lib/rubygems/installer.rb
--- ../ruby-2.4.0/lib/rubygems/installer.rb	2016-09-28 03:16:43.000000000 +0200
+++ ./lib/rubygems/installer.rb	2017-01-31 22:49:11.992624578 +0100
@@ -31,7 +31,7 @@
   # Paths where env(1) might live.  Some systems are broken and have it in
   # /bin
 
-  ENV_PATHS = %w[/usr/bin/env /bin/env]
+  ENV_PATHS = %w[@TERMUX_PREFIX@/bin/env /usr/bin/env]
 
   ##
   # Deprecated in favor of Gem::Ext::BuildError