← Back to Lua Course | Chapter 1: Introduction | Lesson 2 of 7

Installing Lua

You install Lua once and then use the lua command to run your programs.

In this page:

  1. Installing Lua

Installing Lua

On Linux you can install Lua with your package manager, for example apt install lua5.3 on Debian and Ubuntu. On macOS use Homebrew with brew install lua. On Windows you can use a prebuilt binary package or WSL. Afterwards check the version with lua -v.

Note: This course targets Lua 5.3, so pick a 5.3 package if your system offers several versions.

Example: Installing Lua

bash
$ sudo apt install lua5.3
$ lua5.3 -v
Lua 5.3.6  Copyright (C) 1994-2020 Lua.org, PUC-Rio
$ brew install lua

⚠️ Run this in your own terminal or Node.js environment.

Common Mistakes
  1. Installing a different major version and expecting identical behaviour
  2. Forgetting that the command may be named lua5.3 on some systems
  3. Not reopening the terminal after changing PATH
Chapter Summary
  • Use a package manager to install Lua
  • lua -v prints the installed version
  • The command name can include the version number
  • Versions 5.1 to 5.4 differ in details
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.