Emacs warning on macOS: ls does not support --dired

Photo by davisuko on Unsplash

Emacs warning on macOS: ls does not support --dired

Table of contents

Current issue

This warning is displayed when opening a Dired buffer.

The cause is that ls doesn't support the --dired option on macOS.

Solutions

Use gls (GNU flavored ls).

brew install coreutils

init.el:

;; without use-package
(when (and (eq system-type 'darwin) (executable-find "gls"))
  (setq insert-directory-program "gls"))

;; with use-package
(use-package dired
  :defer t
  :config
  (when (and (eq system-type 'darwin) (executable-find "gls"))
    (setq insert-directory-program "gls")))