Following the advice of Malabarba and lunaryon, I noticed this piece of code that was blocking the
(setq delete-by-moving-to-trash t
I commented it and everything works fine now.
After trying a recommendation from
Emacswiki, the following works fine:
(setq delete-by-moving-to-trash t)
(defun system-move-file-to-trash (file)
"Use \"trash\" to move FILE to the system trash.
When using Homebrew, install it using \"brew install trash\"."
(call-process (executable-find "trash")
nil 0 nil