Apps embedding lua won't find your luarocks installation out-of-the box.
In a terminal, you have to run:
eval $(luarocks path --lua-version 5.4 --bin)
which sets LUA_PATH
and LUA_CPATH
environment variables, but it applies only for apps launched from within that shell session.
To have those environment variables effective for all applications launched from macOS (Finder, Launch Control, etc) you have to use launchd:
#!/bin/sh
eval $(luarocks path --lua-version 5.4 --bin)
launchctl setenv LUA_PATH "$LUA_PATH"
launchctl setenv LUA_CPATH "$LUA_CPATH"
save the above into a script and run it.
You can also have it run automatically at login, by creating a LaunchAgents file e.g. ~/Library/LaunchAgents/org.luarocks.setenv.plist
with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.luarocks.setenv</string>
<key>ProgramArguments</key>
<array>
<string>/bin/sh</string>
<string>/path/to/the/above/script.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
replace /path/to/the/above/script.sh
with the actual path of the previous script.