racket Installation steps (Linux) Installation or Setup


Example

Visit https://download.racket-lang.org and choose between the two available distributions:

  • Racket is the main distribution, it comes with several additional packages like math/number-theory as well as the DrRacket IDE.
  • Minimal Racket is far smaller and comes only with the needed packages.

Installation steps for Linux:

The installation is very simple. If you are used to this kind of thing, just follow these four steps. A more detailed step-by-step walkthrough is detailed afterwards, if you prefer.

  1. download it from https://download.racket-lang.org
  2. chmod +x racket-6.6-x86_64-linux.sh
  3. ./racket-6.6-x86_64-linux.sh
  4. Answer the questions, and possibly update your $PATH.

For a more detailed step-by-step guide, see below.

Downloading

  1. Go to https://download.racket-lang.org .
  2. Select Platform: Linux i386 if you have a 32-bit system, or Platform: Linux x86_64.
  3. Click the download button labeled racket-6.9-x86_64-linux.sh (113M) (the label may be slightly different depending on the version).

Starting the installer

  1. Open a terminal.
  2. If you downloaded the file to the /home/YOUR_USER_NAME/Downloads, type the following command:

cd /home/YOUR_USER_NAME/Downloads

Be sure to replace YOUR_USER_NAME by your actual user name and /Downloads by the actual path to the folder to which you downloaded Racket.

  1. Type chmod +x racket-6.6-x86_64-linux.sh (change the version number and the x86_64 to match the file you downloaded).
  2. If you want to install Racket system-wide, type sudo ./racket-6.6-x86_64-linux.sh (change the version number and the x86_64 to match the file you downloaded).

Otherwise, if you are not an administrator on the computer, simply type ./racket-6.6-x86_64-linux.sh to install it in your own home directory (change the version number and the x86_64 to match the file you downloaded).

Installing

The installer will ask the following questions:

  1. Do you want a Unix-style distribution?

Answer no (the default).

  1. Where do you want to install the "racket-6.6.0.4" directory tree?

Select /usr/racket (type 1 Enter ⏎) or /usr/local/racket (type 2 Enter ⏎) if you are installing Racket system-wide. Otherwise, to install it in your own home directory (e.g. if you are not an administrator), select ~/racket (/home/YOUR_USER_NAME/racket) (type 3 Enter ⏎).

  1. If you want to install new system links within the "bin", "man" and "share/applications" subdirectories…

If you are doing a system-wide installation it is a good idea to type /usr/local or /usr here (to know which, check which one is present in your PATH, by typing echo $PATH in another terminal window). If you are installing it in your own home directory, leave the answer empty and just press Enter ⏎.

Starting DrRacket

Depending on your answer to steps 9 and 10, you need to type one of the following commands in a terminal to start DrRacket:

  • drracket (if step 10 was successful)
  • /usr/racket/bin/drracket
  • /usr/local/racket/bin/drracket
  • /home/YOUR_USER_NAME/racket/bin/drracket (replace YOUR_USER_NAME by your actual username, or simply type ~/racket/bin/drracket)

To avoid typing such a long command each time, you can add the following command to the file ~/.bashrc, where /path/to/the/containing/folder/ should be one of /usr/racket/bin/, /usr/local/racket/bin/ or /home/YOUR_USER_NAME/racket/bin/:

export PATH="/path/to/the/containing/folder/:$PATH"

Running your first program

To run a program, open DrRacket as explained above, enter the program starting with #lang racket, and click the Run button near the top-right corner. Here is a first example program:

#lang racket
(displayln "Hello Racket!")