Can't install WordGrinder on Yosemite Recently, I have been trying to install WordGrinder on Yosemite. First I tried getting the latest tar packages from the developers' website and using them, but I ran into some library linking errors with lua and ncursesw. I tried using MacPorts because I assumed that it would do all of that for me, but it turns out that the problems I encountered first were just confusion left over from some earlier dirty MacPorts installs - I ran port selfupdate and those went away. After yet more difficulty with MacPorts, I decided to reconsider building from source. But now, when I use make, I get the following series of errors:


Maat:wordgrinder-0.5.1 Matt$ make
CC .obj/release/src/c/arch/unix/cursesw/dpy.o
error: unable to open output file '.obj/release/src/c/arch/unix/cursesw/dpy.o': 'Error opening output file '.obj/release/src/c/arch/unix/cursesw/dpy.o': Permission denied'
1 error generated.
make: *** [.obj/release/src/c/arch/unix/cursesw/dpy.o] Error 1
Maat:wordgrinder-0.5.1 Matt$ sudo make
CC .obj/release/src/c/arch/unix/cursesw/dpy.o
src/c/arch/unix/cursesw/dpy.c:164:8: error: use of undeclared identifier 'KEY_EVENT'
                case KEY_EVENT: return "KEY_EVENT";
                     ^
1 error generated.
make: *** [.obj/release/src/c/arch/unix/cursesw/dpy.o] Error 1
Maat:wordgrinder-0.5.1 Matt$ 


First, I have to use sudo to get the compiler to access the output file (I don't think I am supposed to have to do that, but not the main issue), and then, when I do, I run into the other one, about the "use of undeclared identifier 'KEY_EVENT'". I went over the makefile and the README.Unix several times, but I can't make head nor tail of it. I read in another, unrelated issue with installing WordGrinder on OS X that "building on Mac is a pig," and now I can't help but agree. What is going wrong, and how can I get WordGrinder to install properly on OS X?

EDIT 3:
In the end, I wiped my convoluted /usr/local and /opt folders and reorganized a large portion of my filesystem. I installed Homebrew on the clean slate I had created, then installed lua and Homebrew/dupes/ncurses using Homebrew as per the steps Alistair listed in his answer. I then downloaded wordgrinder-0.5.2.1 instead of wordgrinder-0.5.1, because 0.5.2.1 had added Homebrew installation support. No more issues with the backspace key. At this point, wordgrinder-static would run, but wordgrinder wouldn't (again, as Alistair reported). Installing luafilesystem allowed wordgrinder to run, as I predicted in an earlier revision of this answer. I used Homebrew to install luarocks in my Cellar (brew install luarocks) and then used luarocks to install luafileystem in my /usr/local/lib/luarocks/rocks directory. wordgrinder now runs perfectly well, with no issues.

Many thanks to Alistair for all the help. I did learn a lot more than I already did in the process of trying to get this to work, and may be able to take on the rest myself - as I said earlier, I will document my results here as I come up with them.
UPDATE: As pointed out by Matthew below, the recently released 0.5.2.1 has better support for OS X and brew now, so downloading, extracting wordgrinder-0.5.2.1.tar.bz2 from http://sourceforge.net/projects/wordgrinder/files/wordgrinder/ and running make should work. The only dependency you need to install through brew now seems to be lua, so brew install lua first if you don't already have lua installed.

ORIGINAL: Here's how I got it to work with the previous version...


Downloaded and extracted the wordgrinder-0.5.1.tar.bz2 file from http://sourceforge.net/projects/wordgrinder/files/wordgrinder/
Used brew to install lua: brew install lua
Used brew to install ncurses from homebrew-dupes: brew install homebrew/dupes/ncurses
Made the following modifications to the Makefile. You can download the modified file here.

added a definition of z_crc_t
modified LDFLAGS so it can find libraries installed through brew
modified CPPFLAGS and INCLUDES so it can find include files installed through brew
modified ldflags because it is looking for "lua5.2" but the library on OS X is called "lua.5.2"

Ran make which runs okay with these changes. bin/wordgrinder crashes right away but bin/wordgrinder-static seems to run okay.
'sudo make install' fails, so I just copied wordgrinder-static to /usr/local/bin and it appears to work successfully there.