-
-
Save darcyparker/153124662b05c679c417 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash | |
#Build and install neovim for Debian | |
#See: https://neovim.io/ | |
#See: https://github.com/neovim/neovim/wiki/Building-Neovim#quick-start | |
#See: https://gist.github.com/darcyparker/153124662b05c679c417 | |
#Save current dir | |
pushd . > /dev/null || exit | |
#Install dependencies | |
sudo apt-get update | |
sudo apt-get install -y \ | |
autoconf \ | |
automake \ | |
cmake \ | |
g++ \ | |
gettext \ | |
libncurses5-dev \ | |
libtool \ | |
libtool-bin \ | |
libunibilium-dev \ | |
libunibilium4 \ | |
ninja-build \ | |
pkg-config \ | |
python3-pip \ | |
software-properties-common \ | |
unzip | |
# Enable use of python plugins | |
# Note: python neovim module was renamed to pynvim | |
# https://github.com/neovim/neovim/wiki/Following-HEAD#steps-to-update-pynvim-formerly-neovim-python-package | |
# pip3 uninstall pynvim neovim | |
pip3 install setuptools | |
pip3 install --upgrade pynvim | |
gem install neovim | |
npm install -g neovim | |
#Get or update neovim github repo | |
mkdir -p ~/src | |
cd ~/src || exit | |
if [ ! -e ~/src/neovim ]; then | |
git clone https://github.com/neovim/neovim | |
else | |
cd neovim || exit | |
git pull origin | |
fi | |
cd ~/src/neovim || exit | |
git checkout master | |
#Remove old build dir and .deps dir | |
rm -rf build/ | |
rm -rf .deps/ | |
make distclean | |
# Build and install neovim | |
make CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=/usr/local/" | |
make install | |
# Enable use of ruby plugins | |
# sudo gem install neovim | |
#Restore dir | |
popd > /dev/null || exit | |
echo "nvim command: $(command -v nvim)" | |
echo "nvim command: $(ls -al "$(command -v nvim)")" |
apt install gettext
is also needed on Debian stretch AMD64
I think it should be
sudo make install
also
# Enable use of python plugins
pip2 install --user --upgrade neovim
pip3 install --user --upgrade neovim
but in the nvim help for "provider"
The old "neovim" module was renamed to "pynvim". https://github.com/neovim/neovim/wiki/Following-HEAD#20181118
If you run into problems, uninstall both then install "pynvim" again:
python -m pip uninstall neovim pynvim
python -m pip install --user --upgrade pynvim
so
# Enable use of python plugins
pip2 install --user --upgrade pynvim
pip3 install --user --upgrade pynvim
(I, myself, use the python -m ... style, as it works in windows shells, but pip2 and pip3 are fine on Debian)
also, I think
git clone --single-branch --branch stable https://github.com/neovim/neovim
# git clone --single-branch --branch <branchOrTag> <repository>
also, I like to see what's going on
#!/usr/bin/env -S bash -x
maybe 'tee' the make output to a log file?
and libunibilium0
should be libunibilium4
Thanks for pointing out apt install gettext
@yatesco. I let this gist got stale/out of date for awhile. I just updated with the latest version of the script I use for neovim. It has the pip2
and pip3
commands too @WaterSibilantFalling.
Other aspects of this script may become out of date... The best reference is probably https://github.com/neovim/neovim/wiki/Building-Neovim#quick-start as mentioned in comments. I'll update this periodically if I remember... but it works well as is for my needs. I hope it helps others if they need an example of what works.
Good to know about libunibilium4
. I have no problems with libunibilium0
, but I see 4 is a newer version.
git clone --single-branch
is a nice optimization for cloning just the branch you need. And extra switches to debug or see what is going on with bash/make may be desirable... but I'll let the user tune this script as they need it.
I don't agree with sudo make install
(my personal choice/practice is to always install things I make to /usr/local
and never as root/sudo.) If I am using a distro where I don't have root/sudo access and where root owns /usr/local/
, I do something like this: (and if I can't do this, I install to my home dir.) The sooner I do the chown
and chmod
the better... because there could be some edge cases where the installer sets up different permissions that what I am defining as defaults for existing files.... I usually do it before I install anything to /usr/local
.
sudo chown -R "$USER":users /usr/local
sudo find /usr/local -type d -exec chmod "u=rwx,g=rwx,o=rx" {} \;
sudo find /usr/local/bin -type f -exec chmod "u=rwx,g=rwx,o=rx" {} \;
sudo find /usr/local/bin -type l -exec chmod "u=rwx,g=rwx,o=rx" {} \;
Tested this on Debian 10 and worked like a charm.
Just a side note:
libunibilium0
is not found on debian repos. Installed libunibilium4
instead and no issues.
Thanks Darcy!
@marianopw - Fixed libunibilium0
. The other day I tested and I had libunibilium0
and neovim build worked. The machine I tested on maybe had libunibilium0
from a time when it did exist in repo... then I upgraded. It certainly does not exist now. I updated the script.
How to uninstall this? It says It cant make uninstall since there's no such rule for it.
@SaffronSlumber - I did not write a script to uninstall. And as you mentioned the nvim
dev team did not write a make uninstall
rule. This is just a script to help build neovim and run its make install
to install it to /usr/local
. If you want to remove it, observe the files in stdout
that were copied to /user/local/nvim
during make install
. For example:
/user/local/bin/nvim
/user/local/lib/nvim/
/user/local/share/nvim/
"$HOME/$NVIM_DIR/"
There may be a few other files... Its the usual process for removing a program you'd build from source and install to /usr/local
If you want a clean way to install/remove without building from source, you probably want to use a distribution like https://manjaro.org/
@darcyparker Oh, got it. Thanks!!
In line 65 , it is better change
make install
to
sudo make install
@marcuslannister - I disagree... See comment https://gist.github.com/darcyparker/153124662b05c679c417?permalink_comment_id=3080477#gistcomment-3080477 above. If you want to live dangerously and do sudo make install
with MAKE_INSTALL_PREFIX=/usr/local/"
, go ahead... but I never sudo make install
to /usr/local
.
@marcuslannister - I disagree... See comment https://gist.github.com/darcyparker/153124662b05c679c417?permalink_comment_id=3080477#gistcomment-3080477 above. If you want to live dangerously and do
sudo make install
withMAKE_INSTALL_PREFIX=/usr/local/"
, go ahead... but I neversudo make install
to/usr/local
.
Ok, I got it. Thanks.
As of march 2023, neovim (0.9.0 pre-release) needs ibvterm-dev from experimental (0.3.1-1). Fortunately, this is available in experimental. Also, we use ninja as the build back end. So the above method of making Debian package is not current.
Of course, you can probably build it using upstream source combined with debian/* files in the latest Debian package. But I am making deb package using CMAKE (CPACK). under Debian testing (bookworm).
See https://osamuaoki.github.io/en/2023/03/05/vim-learn-7/#get-latest-neovim
Just a big thank you @osamuaoki !
On raspbian I had to first
apt install gettext
. The error I was getting at first was: