Jon Atkinson

Jon Atkinson

title: "TabNine on FreeBSD" date: 2019-11-05 12:24:36.307000+00:00

I'm a big fan of TabNine, a machine-learning powered omni-completer for pretty much any language. It's a hassle to run with FreeBSD, though. These instructions cover running TabNine with Neovim, but you can ignore the Vim-specific parts if you just want to run the TabNine binary on FreeBSD.

First, install the plugin in your Neovim configuration file:

Plug 'zxqfl/tabnine-vim'

Save your configuration, then :source % and :PlugInstall. Restart nvim, and after a short compliation delay, you'll see that TabNine fails to load. Time to fix this. First, we need CMake, which te TabNine install script requires. Then we need to enable the Linux binary compatibility layer for FreeBSD:

# For the installer
$ sudo pkg install cmake

# For Linux binary compatibility
$ sudo kldload linux64
$ sudo kldstat
$ sudo pkg install emulators/linux_base-c7

Now, we can manually run the installer. I only have python3.6 installed on my FreeBSD system, yours may differ:

$ cd ~/.config/nvim/plugins/tabnine-vim/
$ python3.6

Once this has completed, we need to manually 'brand' the binary as a linux binary so that the operating system knows to use the Linux compatibility layer:

$ cd ~/config/nvim/plugins/tabnine-vim/binaries/2.1.11/x86_64-unknown-linux-musl/
$ brandelf -t Linux ./TabNine
$ ./TabNine --version
TabNine 2.1.11 (x86_64-unknown-linux-musl)
Jacob Jackson ([email protected])

Now you can just start your editor/IDE normally, and the ./TabNine binary should work normally.

I've not upgraded my TabNine since I wrote these instructions, but I expect it will be necessary to re-brand the binary each time it is rebuilt.