Low Orbit Flux Logo 2 F

Lua Install

If you are looking for information on how to install Lua, then you have made a great choice. Lua is a great language.

Lua Install on OSX

NOTE:

Download, unpack, and build it:


curl -R -O http://www.lua.org/ftp/lua-5.4.0.tar.gz
tar zxf lua-5.4.0.tar.gz
cd lua-5.4.0
make all test

Test it:


src/lua -v

Move the directory over to /opt because that is where I like to install things:


cd
sudo mv lua-5.4.0 /opt

If you prefer to leave it in your home directory, that’s fine too.

Add this to your path:


/opt/lua-5.4.0/src

That usually means adding an export line to the end of your .zshrc file. This file will be found in your home directory.

You can use whatever editor you like but I use vi like this:


vi .zshrc

Add a line like this:


export PATH=/opt/lua-5.4.0/src:$PATH

In my case I already had a line change the path for something else so I just added the Lua path to that like this:


export PATH=/opt/lua-5.4.0/src:$HOME/.gem/ruby/2.6.0/bin:$PATH

If you choose to keep LUA in your home directory and not move it to /opt (for example if you don’t have permission on a work or school system) you can just define your path based on your home directory like this:


export PATH=$HOME/lua-5.4.0/src:$PATH

Open a new terminal to make sure your profile is getting sourced properly. Test running Lua from there.


lua -v

References