Skip to content

Running Your Programs

There are two ways to run a L5 program -- one method is using the desktop and the other uses the command line interface (CLI). If you are new to computing or are unsure about the CLI, then run from the desktop!

IDEs such as ZeroBrane Studio, Sublime Text, VS Code, Notepad++, and SciTE all support launching LÖVE programs (the engine to run our L5 scripts), though require additional setup configuration not covered here.

Running L5 from the desktop

The easiest way to run your L5 program is to drag the folder containing your main.lua onto the Love2d application. Remember to drag the folder containing main.lua, and not main.lua itself.

It should launch and open a new window with your sketch running in it, or print an error message. If you're running the L5 Starter program, you should see a square window with a yellow background. Congratulations.

By default, print() output only appears if you run your program from the command line. To display print output directly in your sketch window add printToScreen() to your setup() function.

Once you have a sucessfully running program, you're ready for your next steps writing programs with L5. Check out L5 for Processing-p5.js programmers, tutorials or the reference.

Running L5 from the command line

Windows Command line

You can launch your programs from the command line and add the --console flag to be able to see print() and error() output as well:

"C:\Program Files\LOVE\love.exe" --console 
"C:\Users\<YourUsername>\Desktop\L5-starter"

Replace <YourUsername> and Desktop\L5-starter with your actual username and the location of your program folder.

macOS Command Line

There are a few extra steps to smoothly set up command line usage for L5 in the command line on Mac.

If Love is installed in your applications folder you can run:

open -n -a love "~/path/to/my-program"

This will not send debugging and print information to the Terminal nor any describe() text. To see printed text in the command line you need to run the Love program from Applications, like this:

/Applications/love.app/Contents/MacOS/love ~/path/to/my-program

You can set up an alias in your Terminal session to call the binary when you use love by adding an alias to your ~/.zshrc file (Z shell configuration file).

Open the file with:

open -a TextEdit ~/.zshrc

You may have to create the file first if it does not yet exist.

touch ~/.zshrc

Then paste in the following code and save the file:

# alias to love
alias love="/Applications/love.app/Contents/MacOS/love"

Now you can call love from the command line like Linux and Windows:

love ~/path/to/my-program

If this doesn't works you should reload the .zshrc file and then try running the program again.

source ~/.zshrc
love ~/path/to/my-program

Linux Command line

In the Terminal, you can run love path/to/L5-starter. Or if you are in the folder with your program, run love . to launch your project from the current directory.

Instructions adapted from Love2d wiki: Getting Started, GNU Free Documentation License 1.3.

Amazing! Now you are ready to start learning with First Steps. If you are familiar with Lua, p5.js, or Processing already, you should take a look at L5 for Processing-p5.js Programmers.