       (goto-char (point-min))
       (search-forward-regexp "cannot satisfy -package" nil t 1))))
 
+(defun intero-executable-path (stack-yaml)
+  "The path for the intero executable."
+  (intero-with-temp-buffer
+    (cl-case (save-excursion
+               (intero-call-stack
+                nil (current-buffer) t intero-stack-yaml "path" "--compiler-tools-bin"))
+      (0 (replace-regexp-in-string "[\r\n]+$" "/intero" (buffer-string)))
+      (1 "intero"))))
+
 (defun intero-installed-p ()
   "Return non-nil if intero (of the right version) is installed in the stack environment."
   (redisplay)
   (intero-with-temp-buffer
-    (if (= 0 (intero-call-stack nil t nil intero-stack-yaml
-                                "exec"
-                                "--verbosity" "silent"
-                                "--" "intero" "--version"))
+    (if (= 0 (intero-call-stack
+              nil t nil intero-stack-yaml
+              "exec"
+              "--verbosity" "silent"
+              "--"
+              (intero-executable-path intero-stack-yaml)
+              "--version"))
         (progn
           (goto-char (point-min))
           ;; This skipping comes due to https://github.com/commercialhaskell/intero/pull/216/files

      (erase-buffer)
      (insert (cl-case install-status
                (not-installed "Intero is not installed in the Stack environment.")
                (wrong-version "The wrong version of Intero is installed for this Emacs package."))
              (format "

Installing intero-%s automatically ...

" intero-package-version))
      (intero-old-auto-install source-buffer targets buffer stack-yaml))))

(defun intero-old-auto-install (source-buffer targets buffer stack-yaml)
  "Automatically install Intero appropriately for BUFFER.
Use the given TARGETS, SOURCE-BUFFER and STACK-YAML."
  (redisplay)
  (cl-case (intero-call-stack
            nil (current-buffer) t stack-yaml

      buffer
    (let* ((options
            (intero-make-options-list
             (intero-executable-path stack-yaml)
             (or targets
                 (let ((package-name (buffer-local-value 'intero-package-name buffer)))
                   (unless (equal "" package-name)
