lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, 14 Jan 2011 15:56:46 +0000
cormullion@mac.com wrote:

> Please - don't read this boring email unless you really want to.
> 
> So, I've decided to try out Lua as a general-purpose scripting
> language for MacOS X. I've heard it's good. (I've already bought the
> iLuaBox app for the iPhone, and it looks like fun.)
> 
> I started here:
> 
> > lua.org
> 
> Nice looking website. I clicked on Download, and, under the heading
> Binaries, read this:
> 
> > If you don't have the time or the inclination to compile Lua
> > yourself, get a binary
> 
> That's me! I don't want to be dealing with compilers and paths and
> all that, so I'll click on MacOS:
> 
> > See [LuaForge Lua Binaries project] for the most recent versions
> > for MacOS X. See also MacOsClassicLua and MacOsxLua.
> 
> Although the MacOSXlua section has a couple of broken links and a
> link to a framework, it does, however, have a link to the Lua
> Binaries (the line above :). I'll click on that.
> 
> I'm now at the binaries at http://luabinaries.sourceforge.net/:
> 
> > Installation
> > 
> > The LuaBinaries files are intended for advanced users and
> > programmers who want to incorporate Lua in their applications or
> > distributions and would like to keep compatibility with
> > LuaBinaries, so they also will be compatible with many other
> > modules available on the Internet.
> > 
> > If what you want is a full Lua installation, please check other
> > projects such as the Lua for Windows, Lua for Linux and LuaRocks.
> 
> Yay, that's me! I want a full Lua installation, cos I'm certainly not
> an advanced user, so off to LuaRocks - I won't bother the Windows or
> Linux pages, I'm sure they'd have lots of problems installing Lua.
> The Luarocks web site looks good, and says: LuaRocks is a pure Lua
> application with no library dependencies.  I realise later that this
> was when my suspicions were first aroused, but I give it a try. I end
> up downloading http://luarocks.org/releases/luarocks-2.0.4.tar.gz
> which appears to be the latest version. (It's at the bottom of the
> page, almost)
> 
> It unzips. I've now got a folder on  my desktop:
> 
>    luarocks-2.0.4:
> 	configure
> 	COPYING
> 	Makefile
> 	README.md
> 	rockspec
> 	src:
> 		bin:
> 			luarocks
> 			luarocks-admin
>   ...
> 
> 
> I'm not sure what to do now, so I figure that I have to run configure:
> 
> > bash configure 
> > Looking for Lua... lua not found in $PATH.
> > You may want to use the flags --with-lua and/or --lua-suffix. See
> > --help.
> 
> Aha. It starts to look like I need a lua before I can install a lua.
> I had started to suspect that anyway, so let's go back to sourceforge
> and download that pre-built binary that I hadn't thought I was going
> to be advanced enough to download:
> 
> http://sourceforge.net/projects/luabinaries/files/5.2-work2/Executables/lua5_2_work2_MacOS106_bin.tar.gz/download
> 
> I downloaded it to the desktop. (Isn't it great how quick Lua-related
> downloads are?)
> 
>  lua5_1_4_MacOS106_bin:
> 	bin2c5.1
> 	lua5.1
> 	luac5.1
> 
> They look like binaries - they have Unix-y icons - so I'll try that
> luarocks configure command again and tell it to look for Lua there:
> 
> > $ bash configure
> > Checking Lua includes... lua.h not found (looked
> > in /Users/me/Desktop/lua5_1_4_MacOS106_bin/lua5.1/include/lua.h)
> > You may want to use the flag --with-lua-include. See --help.
> 
> I'm getting closer, I think. But I obviously need to install a lua.h
> file first.
> 
> I'll go back to the source of all things Lua, lua.org, and see about
> downloading the source code. Perhaps that will have a file called
> lua.h file somewhere. I'll click on the 'source code' link at
> http://www.lua.org/download.html. I download:
> 
> > http://www.lua.org/ftp/lua-5.1.4.tar.gz
> 
> Now I'll try that bash configure command again:
> 
> > bash configure
> > --with-lua=$HOME/Desktop/lua5_1_4_MacOS106_bin/lua5.1
> > --with-lua-include=/Users/me/Desktop/lua-5.1.4/src/ Checking Lua
> > includes... lua.h found in /Users/me/Desktop/lua-5.1.4/src//lua.h
> > curl found at /usr/bin openssl found at /usr/bin Configuring for
> > system... Darwin Configuring for architecture... i386
> > Writing configuration...
> > 
> > Installation prefix: /usr/local
> > LuaRocks configuration directory: /usr/local/etc/luarocks
> > Using Lua from: /Users/me/Desktop/lua5_1_4_MacOS106_bin/lua5.1
> > 
> > Done. You can now run 'make' to build.
> 
> Keenly aware that I'm doing all this because I don't want to make or
> build the source code, I type:
> 
>   make
> 
> >   ... cool bash stuff
> >   ...
> >   Done. Type 'make install' to install into /usr/local.
> 
> There's more? Yes:
> 
>   make install:
> 
> >   even more cool bash stuff
> >   with added error messages
> > mkdir: /usr/local/share/lua: Permission denied
> 
> Ah, I know this one. Thought you could outsmart me, did you? You have
> to remember to type a 'sudo' first:
> 
>   sudo make install
>    
> And it all seems to work OK. At least, there are no errors...
> 
> So I've now installed luarocks, which - you'll remember - promised me
> the full Lua installation. 
> 
> And what use is luarocks now? Well, it's not  happy whenever I run it:
> 
> 	bad interpreter: Not a directory
> 
> I know the problem. It can't get to grips with Lua on this machine.
> And, to be honest, by now neither can I.
> 
> End of part 1.
> 
> PS: Sorry for this boring email. At least I warned you... :))
> 
> 
> 

LuaRocks isn't a Lua distribution; it's a method for distributing Lua
packages.  If you have a C compiler on your Mac, building Lua is
actually pretty easy:

curl http://www.lua.org/ftp/lua-5.1.4.tar.gz | tar xzf -
cd lua-5.1.4/
make macosx

There!  Now you have a lua binary under src! =)

-Rob

Attachment: signature.asc
Description: PGP signature