In this guide, we will learn what Racket is, and the different ways to install Racket programing language on Linux and how to run your first program in Racket.
Table of Contents
What is Racket?
Racket is a general-purpose and multi-paradigm programming language based on Lisp. Racket is specifically based on Scheme, a Lisp-family language, which makes Racket a Scheme dialect. It is also known as programming language for creating new programming languages.
Racket also includes a graphical IDE called DrRacket for developing programs using the Racket programming languages. It is open source, cross-platform that runs on Linux, Mac OS and Windows.
Where Racket Really Shines
- Language-oriented programming: creating DSLs and new language constructs with macros, while preserving lexical scope and good error messages.
- Program analysis and transformation: writing interpreters, compilers, static analyzers, and code generators.
- Education: the
htdp("How to Design Programs") teaching languages are widely used to build a solid foundation in programming. - Rapid scripting: processing text, automating system tasks, and manipulating files concisely — as shown in the systems-scripting section above.
- Research and prototyping: exploring new programming-language ideas, type systems, or algorithms in a single, cohesive ecosystem that includes functional programming, macros, contracts, and modules.
Install Racket Programming Language On Linux
There are couple ways to install Racket in Linux.
Install Racket using PPA
If you're on Ubuntu and its variants like Linux Mint, use the Racket official PPA to install Racket.
sudo add-apt-repository ppa:plt/racket
sudo apt-get update
sudo apt-get install racket
Install Racket from Flathub
Racket is available as flatpak. Make sure you installed flatpak on your system and run the following commands to install Racket:
flatpak install flathub org.racket_lang.Racket
Once installed, you can run Racket using command:
flatpak run org.racket_lang.Racket
Install Racket from Snap Store:
Racket is available as snap package for Ubuntu and its derivatives. In Ubuntu 16.04 and newer versions, run:
sudo snap install racket
Install Racket using the Official Installer Script
On the Linux distributions, download latest Racker installer script from the official download page.
wget https://download.racket-lang.org/installers/9.2/racket-9.2-x86_64-linux-buster-cs.sh
Go to the location where you downloaded the installer script and run the Racket installer script with sudo or root permission:
sudo sh racket-9.2-x86_64-linux-buster-cs.sh
You will be prompted to answer a couple questions. Please read them carefully and answer accordingly.
The first question is - Do you want a Unix-style distribution? There are two choices: YES and NO. If you enter YES, all files will go into different directories according to the Unix conventions. If you choose NO, all files will be kept in a single directory which is easy very for for erasing or moving in future. The default value is NO. If you're a beginner, I recommended you to choose NO. I go with the default value i.e. No.
This program will extract and install Racket v9.2.
Note: the required diskspace for this installation is 737M.
Do you want a Unix-style distribution?
In this distribution mode files go into different directories according
to Unix conventions. A "racket-uninstall" script will be generated
to be used when you want to remove the installation. If you say 'no',
the whole Racket directory is kept in a single installation directory
(movable and erasable), possibly with external links into it -- this is
often more convenient, especially if you want to install multiple
versions or keep it in your home directory.
Enter yes/no (default: no) > no
[...]
The second question is - Where do you want to install Racket? You will be given five choices as listed below.
- /usr/racket - This is the default location. System-wide installation. This is good if you want to let all users in the system to use Racket.
- /usr/local/racket - Same as above (System wide installation).
- ~/racket (/home/user/racket) - Per-user installation. If you are a non-administrator, you can choose this option to install Racket in your $HOME directory itself.
- ./racket (here in the current directory itself).
- Any custom location of your choice.
All you have to do is just enter the number and hit ENTER to proceed. Usually it is good to install system-wide to let all users run Racket program. I go with default option i.e. /usr/racket
[...]
Where do you want to install the "racket" directory tree?
1 - /usr/racket [default]
2 - /usr/local/racket
3 - ~/racket (/home/ostechnix/racket)
4 - ./racket (here)
Or enter a different "racket" directory to install in.
> 1
[...]
The third and final option is - Where do you want to put the system links, such as racket, drracket, raco etc. Choose a common directory (usually your $PATH, for example /usr/local/), so you don't need to type the full path of the executable.
[...] Checking the integrity of the binary archive... ok. Unpacking into "/usr/racket" (Ctrl+C to abort)... Done. If you want to install new system links within the "bin", "man" and "share/applications" subdirectories of a common directory prefix (for example, "/usr/local") then enter the prefix of an existing directory that you want to use. This might overwrite existing symlinks, but not files. (default: skip links) > /usr/local Installing links in "/usr/local/bin"... drracket, gracket, gracket-text, mred, mred-text, mzc, mzpp, mzscheme, mztext, pdf-slatex, plt-games, plt-help, plt-r5rs, plt-r6rs, plt-web-server, racket, raco, scribble, setup-plt, slatex, slideshow, swindle done. "/usr/local/share/man/man1" does not exist, skipping. "/usr/local/share/applications" does not exist, skipping. Installation complete.
Racket has been installed now.
Launch Racket Concole
If you have installed Racket from PPA/flathub/snapcraft, simply type the following command to enter into Racket console:
racket
If you've used the Racket installer script and changed different installation location, type any one of the following commands depending on where you installed it by answering the 2nd and 3rd questions during the installation process.
/usr/racket/bin/racket
Or,
/usr/local/racket/bin/racket
Or,
~/racket/bin/racket
I used PPA, hence I entered into Racket console using command:
racket
This is how Racket command prompt looks like in my Ubuntu 18.04 desktop.
Welcome to Racket v9.2 [cs].
>
To read Racket documentation, type help in the Racket console and hit ENTER. This will open the Racket documentation page in your default web browser.
To exit from the console, press Ctrl+D.
Launch Racket Graphical IDE
If you don't like the command line way or you're a beginner, use DrRacket graphical IDE.
Launch DrRacket from Menu or Dash. You can also start DrRacket from Terminal using command:
drracket
The default interface of DrRacket will look like below.
Type your program in DrRacket interface and press "Run" button on the top right corner.
Here is a simple program to display the given text:
#lang racket (displayln "Welcome to OSTechNix!")
Output:
Learn the Racket Core Concepts
I installed Racket in my Linux box, now what? Learn the essential Racket core concepts with practical examples. Understand expressions, functions, recursion, pattern matching, macros, contracts, streams, Linux scripting, and more in the following beginner-friendly guide.
Uninstall Racket
If you have installed Racket using PPA/flathub/snap store, simply run the following command to remove Racket:
sudo apt --purge remove racket
If you manually installed it using the installer, just remove the installation directory. Double check the path before removing it.
sudo rm -r /usr/racket
Finally, find and delete the unused broken Symlinks which are created during the installation process.
Hope this helps.
Suggested Read:
- How To Install Go Language In Linux
- How To Install NodeJS On Linux
- Install Rust Programming Language In Linux
- Getting Started With Haskell Programming Language
Resource:





2 comments
Thanks for the hint of the PPA repo. I haven’t found this in the official docs.
Would be nice if the install script allowed to run unattended (for example using ansible)
but it insists on asking about unix-style :-/
Ok, `–in-place` did it
./racket-7.6-x86_64-linux.sh –dest “/usr/local/racket” –in-place