diff --git a/bin/env.sh b/bin/env.sh
index d25eb06e50a0e43535526cbe822d7af83ad1f85d..0588937fc0b2748a5a3420fdf5eaff5751e708a5 100755
--- a/bin/env.sh
+++ b/bin/env.sh
@@ -47,9 +47,12 @@ fi
 #  export DETECTOR_CONFIG="${DETECTOR}_full"
 #fi
 
-# main is the new master
 if [ ! -n  "${DETECTOR_VERSION}" ] ; then 
   export DETECTOR_VERSION="main"
+else
+  # handle spack version spec format (e.g. git.fcf90937193c983c0af2acf1251e01f2e2c3a259=main)
+  DETECTOR_VERSION=${DETECTOR_VERSION##git.}
+  export DETECTOR_VERSION=${DETECTOR_VERSION%%=*}
 fi
 
 if [ ! -n  "${DETECTOR_REPOSITORYURL}" ] ; then