How to install Neovim from source on Ubuntu 20.04 LTS

Carlos Hurtado
2 min readJul 1, 2021

--

A simple installation guide

Neovim logo

Why from source?

While Neovim can indeed be installed from the corresponding Ubuntu package, there are attractive reasons to install this awesome text editor from source:

  • Access to the latest features of Neovim
  • Install Neovim in the location you wish

Installation

(1) Install the build prerequisites:

sudo apt-get install ninja-build \
gettext libtool libtool-bin \
autoconf automake cmake g++ \
pkg-config unzip

(2) Clone the Neovim repository:

git clone https://github.com/neovim/neovim.git

(3) To install the stable release, run the following (otherwise the latest version of Neovim will be installed):

git checkout stable

(4) Build Neovim with build type ‘Release’ for better performance and in the location of your choice:

make CMAKE_BUILD_TYPE=Release \
CMAKE_INSTALL_PREFIX=<NEOVIM_LOCATION> install

(5) Add the following line to your .bashrc file:

export PATH=”<NEOVIM_LOCATION>/bin:$PATH”

(6) Enjoy Neovim:

nvim awesome-file.txt

(7) Make sure that everything is in order by typing :checkhealth inside Neovim and verify that the output is similar to this:

Neovim’s :checkhealth partial output

If anything went wrong

If something went wrong during the installation, try the following:

(1) Run the following command in the location where you clone the Neovim repository:

rm -rf build .deps # the command 'make distclean' performs the same

(2) Try again the installation process

Uninstall

If you wish to uninstall Neovim, it is pretty simple:

sudo rm -rf <NEOVIM_LOCATION>

Sources

--

--

Carlos Hurtado

Undergraduate student in Robotics and Digital Systems at ITESM. 💙 Math, science, and robotics. Lifelong learner.