Every time I execute these commands:




in the terminal, it gives me the following error:

-bash: /usr/local/bin/vi: No such file or directory


-bash: /usr/local/bin/vim: No such file or directory

How do I get it to look at /usr/bin instead of /usr/local/bin?

type -a vi vim


vi is /usr/bin/vi
vim is /usr/bin/vim


echo $PATH



I effed up my settings when I was screwing around with MacVim and Homebrew. And now I can't even start vim with vi or vim.

  • What does this command return: type -a vi vim ? What about echo $PATH ? – glenn jackman Jun 3 '13 at 18:49
  • @glennjackman I added the output of these two commands in the question. – nico_c Jun 3 '13 at 18:54
  • What about these: ls -l /usr/bin/{vi,vim}; hash -t vi vim – glenn jackman Jun 3 '13 at 18:59
  • @glennjackman thanks. bmike's answer below fixed the problem for me. – nico_c Jun 3 '13 at 19:00

Set your path to be the following and then you should have temporary control (or just unset the $PATH and type things in exactly like /usr/bin/vi whatever)

 export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

Once you've confirmed all is well, you'll want to sort out the scripts that run each time you log in and set $PATH or just be sure that you delete things from /usr/local to clean up the problems.

  • THANK YOU! That works. Do these settings go in a specific file that I can take a look at? For example, when I execute the command above, what file changes that makes the settings change? – nico_c Jun 3 '13 at 19:00
  • Why not spin that second question off on how to determine which startup files are being run. My guess is you'll need to list the OS version, homebrew version and perhaps look into what exact shell you use if you are not using bash (the default shell). – bmike Jun 3 '13 at 19:01
  • Alright. Thanks for the answer though. – nico_c Jun 3 '13 at 19:02
  • A;sp note if you have /opt/local/bin you have also been playingwith Macports and only one of Macports or Homebrew should be used or you get issues similar to this – mmmmmm Jun 3 '13 at 19:49
  • Might want to look at your ~/.bash_profile to check for any settings that might conflict. – Gregg Leventhal Jun 3 '13 at 20:48

You must log in to answer this question.

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