When trying to open URL link in emacs under MSYS2 I get the error browse-url-default-windows-browser: Searching for program: No such file or directory, cygstart. Looking into the function browse-url-default-windows-browser I found out that it needed to call process cygstart:

    (defun browse-url-default-windows-browser (url &optional _new-window)
      "Invoke the MS-Windows system's default Web browser.
    The optional NEW-WINDOW argument is not used."
    ((eq system-type 'cygwin)
             (call-process "cygstart" nil nil nil url))

But there is no cygstart in MSYS2 according to its wiki How does MSYS2 differ from Cygwin. Though the variable system-type really equals 'cygwin and cannot be changed to anything more appropriate.

How to fix this error?

2 Answers 2


Building on @rucarden's solution I found you can use browse-url-browser-function to replace the original one inside your .emacs. It's a documented setting in browser.el.

(when (eq system-type 'cygwin)
   (lambda (url &optional _new-window)
     (interactive (browse-url-interactive-arg "URL: "))
     (shell-command (concat "start " (shell-quote-argument url)())))))

It seems that start works. I made the following change to browse-url.el and then reloaded it with load-file. There is probably a more elegant way of doing this that doesn't involve modifying browse-url.el.

((eq system-type 'cygwin)
 (shell-command (concat "start " (shell-quote-argument url)))))
  • Yes, it's better not to modify browse-url.el, because the edit will be gone after an update. Nov 26, 2020 at 22:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.