Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

How To Install nvim_rocks on Big Sur macOS 11x

TODO: Fix the formatting of this post

Code

### TL;DR

The key to getting nvim_rocks to install was running this on the command line before running `PlugInstall`

``command
export MACOSX_DEPLOYMENT_TARGET=10.15
``

Notes:

- I didn't have that setting the first time I tried to install. Pretty sure I had to do an uninstall and then manually delete some files, but I didn't document the details of that. 
- Pretty sure I had to have the latest version of the XCode command line tools installed to get this to work. 
- Putting in `11.4` or whatever version of the OS you're running instead of `10.15` might work, but I kept it at this based off the article I saw (which I can't find the link for at the moment)



### Deatils

This is how I got the nvim_rocks neovim plugin to install on my mac running Big Sur (macOS 11.x) using <<link|vim-plug|https://github.com/junegunn/vim-plug>>:

1. Add the plugin call to `~/.config/nvim/init.vim` in the Plug section:

``vim
call plug#begin("~/.vim/plugged")
    " ... other plugins ...
    Plug 'theHamsta/nvim_rocks', {'do': 'pip3 install --user hererocks && python3 -mhererocks . -j2.1.0-beta3 -r3.0.0 && cp nvim_rocks.lua lua'}
call plug#end()
``

2. Exit to the command line and run this:

``command
MACOSX_DEPLOYMENT_TARGET=10.15 nvim +PlugInstall
``




### Notes


I couldn't get nvim_rocks (which provides luarocks) to install on macOS 11.x (Big Sur), it would fail with exit code 1 when I tried to run `PlugInstall` with this in the init.vim:

        Plug 'theHamsta/nvim_rocks', {'do': 'pip3 install --user hererocks && python3 -mhererocks . -j2.1.0-beta3 -r3.0.0 && cp nvim_rocks.lua lua'}


When I pulled out this command:

    python3 -mhererocks . -j2.1.0-beta3 -r3.0.0

it would error out with something like:


``txt
Undefined symbols for architecture x86_64:
  "__Unwind_DeleteException", referenced from:
      _lj_err_unwind_dwarf in libluajit.a(lj_err.o)
  "__Unwind_GetCFA", referenced from:
      _lj_err_unwind_dwarf in libluajit.a(lj_err.o)
  "__Unwind_RaiseException", referenced from:
      _lj_err_throw in libluajit.a(lj_err.o)
  "__Unwind_SetGR", referenced from:
      _lj_err_unwind_dwarf in libluajit.a(lj_err.o)
  "__Unwind_SetIP", referenced from:
      _lj_err_unwind_dwarf in libluajit.a(lj_err.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [luajit] Error 1
make: *** [default] Error 2
Error: got exitcode 2 from command make

[Process exited 1]
``

I found <<link|this|https://github.com/nvim-lua/plenary.nvim/issues/4>> bug report which has an answer that worked for me. 

Prior to running `PlugInstall`, run this on the command line:

``command
export MACOSX_DEPLOYMENT_TARGET=10.15
``

That worked for me. (Not really sure why, but it did)