Guide
Building a Standalone Racket Executable with raco exe
Learn how to use the raco exe command to bundle a Racket source file into a standalone executable for Windows, macOS, or Linux, with steps for GUI apps, size reduction, and verification.
Published by Tasadduq Burney
29 May 2026, 16:47 UTC
2 min50.1K views0

Desired Outcome
Produce a single platform specific executable that runs a Racket program without requiring a separate Racket installation.
Prerequisites
- A working Racket installation (version 6.0 or later) providing the
racketandracocommands. - The source file you want to bundle, for example
myapp.rkt. - Access to a terminal or command prompt with permission to write files in the target directory.
Procedure
- Open a terminal and navigate to the directory containing the source file.
- Determine whether the program uses GUI components. If the source begins with
#lang racket/guior creates windows, you must build a GUI executable; otherwise a console executable is sufficient. - Run the
raco execommand. For a console executable: - If you need a GUI executable, add the
-guiflag: - Optional: preserve the original source filename for debugging with
--orig-exe: - Optional: reduce the binary size. After building, you can run
strip(on Unix) orupxif available:
raco exe -o .rkt
Replace with the desired executable name (for example myapp) and with the base name of your source file.
raco exe -gui -o .rkt
raco exe --orig-exe -o .rkt
strip
or
upx
Expected Checks
- Run the generated executable on a machine that does not have Racket installed. For a console program, verify that its output matches the output of
racket .rkt. - Check the file type with platform specific tools. On Unix like systems:
- On Windows, use
sigcheckor the file properties to confirm it is a PE executable for the correct architecture (x86 or x64). - If the program uses GUI, launch the executable and confirm that a window appears and responds to interaction. Absence of a window usually indicates the
-guiflag was omitted or the source does not declare#lang racket/gui.
file
should report something like ELF 64 bit LSB executable, x86 64 for Linux or Mach O 64 bit executable x86_64 for macOS.
Recovery Options
- If the executable fails with a missing library error, locate the required DLL or .so file referenced via
ffi/unsafeand either copy it alongside the executable or bundle it manually. - If the program behaves differently than when run with
racket, rebuild without optimization flags (the defaultraco exealready uses the standard compilation level). - To start over, delete the generated executable (
rmon Unix ordel .exeon Windows) and repeat the procedure.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.