lua-users home
lua-l archive

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


You can also just type "which lua" to find the path to the lua executable that is the first on in the path.

If you're up for installing homebrew, I tend to think it's a bit easier to manage packages such as lua. You can always install it to some known directory by passing a custom prefix to "./configure" and adding that to the front of the path too.


On Tue, Jan 21, 2014 at 8:01 PM, Paige DePol <lual@serfnet.org> wrote:
On Jan 21, 2014, at 9:35 PM, Nick Moore <nick_r_moore@hotmail.com> wrote:

> Hi Everyone,
>
> I am  having a bit of an issue updating Lua on Mac OS X 10.9.  I am pretty new to Lua and wanted to start learning it.  I decided to check to see the version number I had so I typed in lua -v and got this response:
>
> Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
>
> So I went here http://www.lua.org/manual/5.2/readme.html and followed the instructions.
>
>
> Running lua -v still shows the 5.1.4 message.  I went to http://luadist.org and attempted to install using their instructions and it still says the same thing.  Lua 5.1.4.
>
>
> It seems like it installs 5.2.3.  I am not seeing an error.  Am I just making an incredibly noobish mistake somewhere?
>
>
> Thanks,
> Nick


To the best of my knowledge OSX 10.9 does not come with Lua pre-installed. I am on OSX, and I do have Lua compiled (but not installed) and if I type "lua -v" at the command line I get: "-bash: lua: command not found".

If you type "echo $PATH" at the command line something similar (or even the same) as the following will be printed:

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/private/opt/bin/

That is a list of directories, separated by colons, that the system looks for executables given on the command line. They are searched in order and the search stops once the executable has been found.

If you enter "ls -l /usr/bin/lua" at the command line you will either get "ls: /usr/bin/lua: No such file or directory" or, if the file exists at that location you would see something like "-rwxr-xr-x  1 root  wheel  231144 Oct 29 10:06 /usr/bin/lua".

I would suggest going through your $PATH directories using the "ls -l" command above to check each directory and see where your "lua" executables are installed, and which version they are.

Once you find a Lua executable with the above "ls" command you can then execute that specific version of Lua directly by executing it with the full path, like this: "/usr/bin/lua -v", which would then print the exact version of that Lua executable.

When you are installing the newer Lua it may be going into the "/usr/local/bin" directory, and the older Lua may be living in "/usr/bin". As the "/usr/bin" dir comes first in the PATH the system would always find the older Lua before the newer one in "/usr/local/bin". I do not know if this is your exact problem, however, this is a common issue when installing command line software on unix-type systems.

As Lua does not come with OSX something else probably installed it and may require that specific version of Lua, so be careful upgrading it. I would suggest simply renaming the older version of Lua with the "mv" command; for example if the older lua was in your "/usr/bin" directory you could rename it like so: "sudo mv /usr/bin/lua /usr/bin/lua.514". NOTE: the "sudo" command will require your password as the "/usr/bin" directory is a protected system directory!

Good luck tracking down your issue, if you need additional assistance with OSX and Lua you may contact me off-list as well!

~pmd~