Software⏱️ 3 min read📅 2026-06-11

How to Fix: sourcing the .vimrc gives E174 error

Error fixing .vimrc sourcing issue in vim on Mac os X.

Quick Answer: Try running ':source %' to reload the .vimrc file without restarting vim.

The error E174: Command already exists: add ! to replace it occurs when you attempt to reload your .vimrc filewithout restarting Vim, which is a common issue for users who frequently edit their configuration files. This problem affects Mac OS X users who are using the Vim text editor.

This error can be frustrating because it prevents you from updating your .vimrc settings without having to restart the application. However, don't worry, we have some solutions to help you reload your .vimrc file and get back to work quickly.

⚠️ Common Causes

  • The first main reason why this error happens is that Vim has a built-in feature called 'command history' which remembers all the commands you've entered. When you try to reload your .vimrc file, Vim checks if there's already an existing command with the same name (in this case, 'add !'). If it finds one, it displays the error message E174.
  • Another alternative reason could be that there's a syntax error in your .vimrc file. If Vim detects a syntax error while parsing your configuration file, it may also display the E174 error.

🛠️ Step-by-Step Verified Fixes

Reload vimrc using :source

  1. Step 1: Open Vim and navigate to the directory where your .vimrc file is located.
  2. Step 2: Type ':source ~/.vimrc' (or the actual path to your .vimrc file) in the command line. Press Enter to execute the command.
  3. Step 3: This will reload your .vimrc file without restarting Vim, allowing you to test your changes.

Unload and reload vimrc using :source !

  1. Step 1: Open Vim and navigate to the directory where your .vimrc file is located.
  2. Step 2: Type ':unload all' (or ':so ~/.vimrc !') in the command line. Press Enter to execute the command.
  3. Step 3: This will unload any existing commands from your .vimrc file, allowing you to reload it without conflicts.

🎯 Final Words

By following these steps, you should be able to reload your .vimrc file and fix the E174 error. Remember to always back up your configuration files before making changes, and if you're still having trouble, consider seeking help from a Vim expert or online community.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions