PICO-8 Wiki
printh( str, [filename,] [overwrite,] [save_to_desktop] )
Prints a string to a console window that is running PICO-8, or to a file or the clipboard.
The string to print.

The name of a file to append the output, instead of printing to the console. If this is the string "@clip", the message replaces the contents of the system clipboard instead of writing to a file.

If filename is provided and is the name of a file and overwrite is true, this overwrites the file. The default is false, which appends the message to the end of the file.

Create or modify filename on the desktop instead of in Pico-8's data directory.

You can use printh() to emit debugging information without printing it on the PICO-8 display. It can emit this output to a command console window, to a file, or to the system clipboard.

Running PICO-8 in a console window[]

To see the output of printh() in a window, you must run PICO-8 from a command console. How to do this depends on which operating system you're using.


  • In Windows, instead of double-clicking the PICO-8 icon, open Command Prompt, then start PICO-8 with the following command:
"\Program Files (x86)\PICO-8\pico8.exe"

The prompt appears immediately, even though PICO-8 is running. printh() output will appear in this window anyway.

  • Alternatively, create a file in the same folder as pico8.exe named pico8.bat containing this line:
cmd /k start pico8.exe

When you double-click on this file, it opens a Command Prompt window and runs PICO-8. Messages appear in the window, and the window closes automatically when PICO-8 exits.

  • Similar to the above method, you can create a windows shortcut file that launches pico-8 with an attached console; details + video here

Mac OS X[]

In Mac OS X, instead of double-clicking the PICO-8 icon, open Terminal, then start PICO-8 with the following command, adjusting the path to match where you put the app. For example:


If you don't want to type that into your terminal every time, you can add an alias to your terminal configuration file. Open a terminal window, and type:

nano ~/.bash_profile

Then, paste the following (do not add any spaces between the = or it will not work!):

alias pico8=/Applications/PICO-8.app/Contents/MacOS/pico8

Save the file, logout and log back in. You will now be able to type pico8 in the terminal to open the program.


In Linux, you probably already run the pico8 command from a terminal window. If you don't, locate where you put the pico-8/ directory, then run the pico8 command from a terminal window using its full path. For example:


Writing to a file[]

The printh() function accepts optional arguments that tell it to send its output to a file instead of to the console. This works even if PICO-8 was not invoked from a command console.

To append the message to a file, provide a filename as the second argument. This creates the file if it does not exist.

printh('debug: score='..score, 'scores.txt')

To overwrite an existing file instead of appending to it, provide true as the third argument:

printh('scores', 'scores.txt', true)
printh('------', 'scores.txt')

Writing to the system clipboard[]

Writing to the special filename '@clip', you can overwrite the system clipboard.

See Clipboard for full details.


t = 0

function _update()
  t = (t + 1) % 30
  printh('t = '..t)

function _draw()
  circfill(t * 3, t * 3, 4, 8)

See also[]