![]() I'm going to use ~/customlua in this example, but you can use something else as long as it doesn't interfere with your regular ports solution (e.g. HAMMERSPOON INSTALLYou also need to decide where you want to install the new version of Lua we're about to compile. ![]() Usually, this will be the latest version available.įor the purposes of this demonstration, I'm going to install everything in my home directory, but adjust as you like to match your preferred arrangement. HAMMERSPOON DOWNLOADMake sure you download the latest version that matches the major version number of Lua that Hammerspoon is running (in the Hammerspoon console, type _VERSION and hit enter). Once that's done, you'll need to download the latest lua source code. ![]() (You can quit it once the About screen appears). The easiest way is to install Xcode from the App Store application and then run it at least once so that it can install all of the necessary parts where they need to go. If you're using Homebrew or MacPorts, and LuaRocks already, you probably have a compiler already installed, but if you don't, you'll need to install one. If your ports solution already provides Lua 5.4 and it is installed but not used by default, then you can skip to Preparing LuaRocks.įor the rest of us, we have to build the current version of lua ourselves. If you've installed Homebrew in a non-standard location or are using MacPorts, the paths may differ, but it will hopefully be clear enough to you what changes, if any, you may need to make to the steps outlined here. In the past I've hardcoded the paths in myself, but have moved to this solution because it tracks the version of Lua that Hammerspoon is using and will include additional trees that you may have defined for LuaRocks as well.īecause I use Homebrew for other things, what follows is based upon a standard installation of Homebrew for lua (version 5.3 as of this writing) and luarocks. If this doesn't work for you, you can specify the exact path to luarocks by changing line 3 above to something like: local luarocks = "/usr/local/bin/luarocks". HAMMERSPOON CODEHomebrew uses /usr/local/bin by default) then this code should find it and query for the necessary package.path and package.cpath additions. If you're version of luarocks is installed in a common location (e.g. execute( "which luarocks "): gsub( " \n ", " ") specify luarocks path yourself if this doesn't find it in the normal places local luarocks = hs. Local lVer = _VERSION: match( "Lua (. )$ ") The simplest approach I've found to making sure Hammerspoon knows what the paths are for all of the defined trees is to ask luarocks itself:Īdd the following somewhere near the top of your Hammerspoon configuration file (usually ~/.hammerspoon/a), before any lines where you try to load any installed rocks with require: LuaRocks can install rocks into various directories, by default your home directory and a globally available location, but possibly more depending upon how it has been configured on your machine (called trees in LuaRocks parlance). The solutions provided are by no means the only ones, but they have worked for me and I hope will work for you as well. Installing rocks compiled for the correct version of Lua.Updating paths so installed rocks can be loaded.The most commmon challenges I've observed fall into two categories, each of which will be addressed in the following sections: Using Luarocks with Hammerspoon isn't that difficult, but can pose some challenges, especially when the Lua version included with Hammerspoon changes faster than the default (or even available) version of Lua in Homebrew or MacPorts does. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |