Neovim Dot App

Creating a standalone executable for Neovim based on iTerm2

Neovim running as a standalone app

I use Neovim on OS X as my code editor.

I am quite happy to use it in the terminal, but I find it helpful to have a separate application that I can run in full screen and can switch to independently of iTerm2.

I tried some of the standalone Neovim applications, but was generally unhappy with them for one reason or another. So I decided to make a standalone version that runs inside iTerm2.

Running Neovim this way is great because it leverages the power and stability of iTerm2. iTerm2 has great support for customization of appearance and keyboard rebinding.

Here’s how to build a standalone version of Neovim that’s based on iTerm2.

I am not a developer of Mac applications, so the following is based on a bit of trial and error and fiddling around with XCode. This is the method I’ve used to build a standalone version of Neovim several times across several versions of Neovim and XCode.

These steps have been tested with XCode 11.2.

  1. Clone iTerm2 master from GitHub

  2. Open XCode and choose “Open another project…”. Select the directory where you cloned iTerm2.

  1. Change Bundle ID to (something like)

  1. Under Signing & Capabilities change to “Sign to run locally”

  1. In the right-hand pane change Name to Neovim

A window will appear helping you rename all instances of iTerm2 to Neovim.

  1. Update the icons.

Find Supporting Files > Images > Media.xcassets (you can use the filter at the bottom of the file list window)

Grab the Neovim icon from here:

I used Iconfly to generate AppIcon.appiconset (select generate without scaling).

Drag the AppIcon.appiconset folder to Xterm.

Remove the old icon set and rename the new one to the old name.

  1. I tried building at this point but it failed due to a reference somewhere to iTerm2.pch.

In XCode, select the project and go to Build Settings.

Under targets select NeovimSharedArc.

In the filter, enter GCC_PREFIX.

Under the setting Prefix Header, update the value to sources/Neovim.pch.

  1. Replace all references to iTerm2SharedARC-Swift.h with NeovimSharedARC-Swift.h

  2. Build the application by hitting ⌘-R.

  3. Copy Neovim to applications.

Under Products right click on and select “Show in Finder”.

Move to applications.

  1. All done!

You should be able to run now.

What I did after this was create a separate profile for Neovim in iTerm2 that runs the following at startup: nvim && exit. This option is under Profiles > General as “send text at start”) in the iTerm2 (and now Neovim) preferences.