How to update VIM version on a Mac


In order to update the version of VIM on a Mac running on macOS, follow the below steps,


Updating VIM to the Latest Version

    • Step 1:

      Open the Terminal Appliaction.

    • Step 2:

      The first thing that we will do is check if VIM is installed on the system and what is its version. For this run the version command.

      vim --version | head -n 1

      head -n 1 is just to get the version details back and not too much-unwanted information that we do not need.

      If you get a response "zsh: command not found vim" then you do not have VIM installed on your Mac.

    • Step 3:

      Next, we will certain brew commands to update VIM

      brew update
      brew update vim

      The first command is to update the brew package manager (optional), while the second one updates VIM to the latest version available.

    • Step 4:

      Finally we will run the version command again to see if we are at the latest version.

      % vim --version | head -n 1
      VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Dec 16 2022 23:29:16)

Updting VIM to a specific version

    If you want to update VIM to a specific version, make use of the brew search command to know the list of versions available.

    brew search vim

    or,

    brew info vim

    Once you have the version number, you can update to that specific version using the install command,

    brew install vim@<custom-version>

    Note, you may have to update the ./zshrc file in order to use this version. Add the following to your zsh profile file.

    export PATH="/usr/local/opt/vim@<custom-version>/bin:$PATH"

You can know more by following the below links:

- Homebrew Formulae - vim

- https://www.vim.org/

- https://www.vim.org/download.php#mac

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap