When I put the following in ~/.vimrc and save it,

syntax on

vim get errors while opening. I think there are some vim configuration conflicts. Herewith the errors:

Error detected while processing /Users/Home/.vimrc: line 1: E484: Can't open file /usr/share/vim/syntax/syntax.vim

I'd appreciate if you can help to get rid of this problem. I'm running osx snow loepard 6.8

  • If you start vim, type :syntax on and then <Enter>, does it work?
    – jaume
    Commented May 17, 2013 at 8:49
  • It says "No Syntax items defined for this buffer" Commented May 17, 2013 at 13:38
  • How did you install vim? Are you using the version installed by default with OS X?
    – daviewales
    Commented May 18, 2013 at 6:47

2 Answers 2


A quick and dirty fix is to create the missing file with contents:

" Vim syntax support file
" Maintainer:   Bram Moolenaar <[email protected]>
" Last Change:  2001 Sep 04

" This file is used for ":syntax on".
" It installs the autocommands and starts highlighting for all buffers.

if !has("syntax")

" If Syntax highlighting appears to be on already, turn it off first, so that
" any leftovers are cleared.
if exists("syntax_on") || exists("syntax_manual")
  so <sfile>:p:h/nosyntax.vim

" Load the Syntax autocommands and set the default methods for highlighting.
runtime syntax/synload.vim

" Load the FileType autocommands if not done yet.
if exists("did_load_filetypes")
  let s:did_ft = 1
  filetype on
  let s:did_ft = 0

" Set up the connection between FileType and Syntax autocommands.
" This makes the syntax automatically set when the file type is detected.
augroup syntaxset
  au! FileType *    exe "set syntax=" . expand("<amatch>")
augroup END

" Execute the syntax autocommands for the each buffer.
" If the filetype wasn't detected yet, do that now.
" Always do the syntaxset autocommands, for buffers where the 'filetype'
" already was set manually (e.g., help buffers).
doautoall syntaxset FileType
if !s:did_ft
  doautoall filetypedetect BufRead

which is valid (at the very least) for vim 7.0 through 7.3, as the file hasn't changed in years.

If you take a closer look, though, it is quite surprising that vim tries to open /usr/share/vim/syntax/syntax.vim: I checked the path of syntax.vim on different OS X versions and this is what I got:

  • OS X 10.8.3 "Mountain Lion"

  • Mac OS X 10.5.8 "Leopard"


I'd expect Mac OS X "Snow Leopard" to follow a similar pattern, so why is the path different? What has changed in vim, have you compiled a newer version or replaced it?

It could also be that /usr/share/vim/vim<version>/syntax/syntax.vim exists, in which case, as an alternative, you could create a link:

sudo mkdir -p /usr/share/vim/syntax/
sudo ln /usr/share/vim/vim<version>/syntax/syntax.vim /usr/share/vim/syntax/syntax.vim
  • Sorry for the late reply jaume, I had no access to my Mac. I don't remember how I've installed it. in /usr/share/vim, there is this file only: vimrc.save Commented May 19, 2013 at 21:55
  • Thanks for your feedback, why don't you create /usr/share/vim/syntax/syntax.vim with contents as shown above and see if that solves your issue?
    – jaume
    Commented May 20, 2013 at 10:53

For Mac OS Sierra (10.12.6) MacVim 8.0 looks for this syntax file in /usr/local/bin/vim/runtime/syntax/syntax.vim

Here are my steps:

sudo mkdir -p /usr/local/bin/vim/runtime/syntax/
sudo cp /usr/share/vim/vim74/syntax/syntax.vim /usr/local/bin/vim/runtime/syntax/

that should resolve this error.

You must log in to answer this question.

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