mjolnirapp / mjolnir

Lightweight automation and productivity app for OS X
5.2k stars 128 forks source link

'mjolnir.window.internal' not found on M1 Mac #581

Closed rileyjshaw closed 3 years ago

rileyjshaw commented 3 years ago

I’m sorry in advance that I couldn’t get this working on my own. I’ve been happily using Mjolnir for years, but I always fear installing it on a new laptop because I don’t understand lua’s package management.

This time around, I tried installing Mjolnir and its related luarocks modules on an M1 Max Macbook. I updated my package paths as suggested in the README to:

package.path = package.path .. ';/opt/homebrew/share/lua/5.4/?.lua'
package.cpath = package.cpath .. ';/opt/homebrew/share/lua/5.4/?.so'

…since that’s apparently Homebrew’s default location on M1 Macs. It looks like it’s finding some of the modules, but I’m seeing the following error:

/opt/homebrew/share/lua/5.4/mjolnir/window.lua:15: module 'mjolnir.window.internal' not found:
    no field package.preload['mjolnir.window.internal']
    no file '/usr/local/share/lua/5.3/mjolnir/window/internal.lua'
    no file '/usr/local/share/lua/5.3/mjolnir/window/internal/init.lua'
    no file '/usr/local/lib/lua/5.3/mjolnir/window/internal.lua'
    no file '/usr/local/lib/lua/5.3/mjolnir/window/internal/init.lua'
    no file './mjolnir/window/internal.lua'
    no file './mjolnir/window/internal/init.lua'
    no file '/usr/local/share/lua/5.4/mjolnir/window/internal.lua'
    no file '/opt/homebrew/share/lua/5.4/mjolnir/window/internal.lua'
    no file '/usr/local/lib/lua/5.3/mjolnir/window/internal.so'
    no file '/usr/local/lib/lua/5.3/loadall.so'
    no file './mjolnir/window/internal.so'
    no file '/usr/local/lib/lua/5.4/mjolnir/window/internal.so'
    no file '/opt/homebrew/share/lua/5.4/mjolnir/window/internal.so'
    no file '/usr/local/lib/lua/5.3/mjolnir.so'
    no file '/usr/local/lib/lua/5.3/loadall.so'
    no file './mjolnir.so'
    no file '/usr/local/lib/lua/5.4/mjolnir.so'
    no file '/opt/homebrew/share/lua/5.4/mjolnir.so'

It’s also having trouble finding mjolnir.hotkey.internal and mjolnir.alert, despite installing them with luarocks.

I’m stumped; any advice would be greatly appreciated. Thank you!!

rileyjshaw commented 3 years ago

Silly mistake! package.cpath needs to link to the lib directory, not share. The following works for me as an architecture-independent path:

package.path = package.path .. ';/usr/local/share/lua/5.4/?.lua;/opt/homebrew/share/lua/5.4/?.lua'
package.cpath = package.cpath .. ';/usr/local/lib/lua/5.4/?.so;/opt/homebrew/lib/lua/5.4/?.so'