How can I set the path for grep?

When I do grep, vim seems to be looking for /bin/grep but that doesn't exist on my system. It's in /usr/bin/grep instead.

Error from vim:

:!/bin/grep -nH sm 2>&1| tee /var/folders/fd/0cml_1kn237fdwnbfzfsrqqm0000gn/T/v6Hn2jM/11
[No write since last change]
zsh:1: no such file or directory: /bin/grep
(1 of 1): no such file or directory: /bin/grep


  • OSX 10.11.6
  • MacVim 8.0 (119)

1 Answer 1


in ~/.vimrc add

set grepprg=/usr/bin/grep

seems to solve the problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .