Home Linux Install Racket Programming Language On Linux

Install Racket Programming Language On Linux

By sk
Published: Last Updated on 7.4K views

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 provides a graphical IDE called DrRacket for developing programs using the Racket programming languages. Racket is open source, cross-platform that runs on Linux, Mac OS and Windows. In this guide, we will see how to install Racket programing language on Linux.

Install Racket Programming Language On Linux

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

On the Linux distributions, download latest Racker installer script from the official download page.

$ wget https://mirror.racket-lang.org/installers/7.5/racket-7.5-x86_64-linux.sh

Go to the location where you downloaded the installer script and make it executable. In my case, the installer script is saved in the current directory.

To make the Racket installer script executable, simply run:

$ chmod +x racket-7.5-x86_64-linux.sh

Finally, run the Racket installer as shown below.

$ sudo ./racket-7.5-x86_64-linux.sh

You will be asked a couple questions. Please read them carefully and answer accordingly.

The first question is - Do you want a Unix-style distribution? You can choose either YES or 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. I recommended you to choose NO as well. I go with the default value i.e. No.

This program will extract and install Racket v7.5.

Note: the required diskspace for this installation is 525M.

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.

  1. /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.
  2. /usr/local/racket - Same as above (System wide installation).
  3. ~/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.
  4. ./racket (here in the current directory itself).
  5. 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/sk/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.

Install Racket On Linux

Racket has been installed now.

Verify Racket installation

If you have installed Racket using PPA, 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 v7.5.
>

Racket programming console

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.

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.

DrRacket interface

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:

Run simple Racket program in DrRacket interface

Uninstall Racket

If you have installed Racket using PPA, 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:


Resource:

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

2 comments

Günter Zöchbauer March 12, 2020 - 6:10 pm

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 :-/

Reply
March 12, 2020 - 6:19 pm

Ok, `–in-place` did it

./racket-7.6-x86_64-linux.sh –dest “/usr/local/racket” –in-place

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More