Here is a step by step guide of how to install Red locally:
chmod u+x <red-binary>which will make sure that Red can be run on your computer. After that simply run Red using
./<red-binary>. This will build the Red console. Next time you run Red, the console will automatically open.
Done! No installer, no setup, no dependencies(*)! What, that’s all? Yes, there was a time when software used to be done right, that’s what we aim at bringing back. ;-)
(*) We have a temporary dependency on
libcurl3 for Linux platform, so in case it is not installed or if you are running a 64-bit Linux, please check extra instructions from our download page.
Red comes with a interpreter in addition to the compiler, which can be easily accessed using the built-in REPL. Calling Red binary with no argument will open the console and allow you to interact with the language in live:
red>> print "Hello World!" Hello World!
If you are running Red from Windows, you can also use the built-in GUI system and make a more appealing HelloWorld:
red>> view [text "Hello World!"]
Now try something more sophisticated:
red>> view [name: field button "Hi" [print ["Hi" name/text]]]
You can also compile your Red programs and get a single binary with no dependencies. You don’t have to install anything else, the Red binary you have downloaded already contains a complete toolchain for native compilation! Here is how to use it:
In a code or text editor, write the following Hello World program:
Red [Title: "Simple hello world script"] print "Hello World!"
Save it under the name: hello.red
From a terminal (works from DOS too), type:
$ red -c hello.red $ ./hello or from DOS: > red -c hello.red > hello
You should see the Hello World! output.
Want to cross-compile to another supported platform?
$ red -c -t Windows hello.red $ red -c -t Darwin hello.red $ red -c -t Linux-ARM hello.red
Cross-compilation done right: checked! ;-)
Here is a list of currently supported platforms:
MSDOS : Windows, x86, console (+ GUI) applications Windows : Windows, x86, GUI applications WindowsXP : Windows, x86, GUI applications, no touch API Linux : GNU/Linux, x86 Linux-ARM : GNU/Linux, ARMv5, armel (soft-float) RPi : GNU/Linux, ARMv5, armhf (hard-float) Darwin : macOS Intel, console-only applications macOS : macOS Intel, applications bundles Syllable : Syllable OS, x86 FreeBSD : FreeBSD, x86 Android : Android, ARMv5 Android-x86 : Android, x86
Save the following code in hello-gui.red file:
Red [Needs: 'View] view [text "Hello World!"]
Compile and run it the same way as the first hello.red script (just replace the filename with hello-gui.red). Notice that compiled GUI apps requires a
Needs: 'View declaration in the Red header block. This tells the compiler to import the View module, which contains all the GUI supporting code.
You can now continue your journey discovering all the great features of Red through the following links:
Happy coding/hacking and have fun…that’s the whole point! ;-)