Ruby Environment
Local Environment Setup
If you want to set up an environment for the Ruby programming language, read this chapter. This chapter will explain all the important topics related to environment setup. It is recommended to study the following topics first before going deeper into other topics:
-
Ruby Installation on Linux/Unix: If you want to set up a development environment on Linux/Unix, see the contents of this chapter.
-
Ruby Installation on Windows: If you want to set up a development environment on Windows, see the contents of this chapter.
-
Ruby Command-Line Options: This chapter lists all the command-line options that you can use with the Ruby interpreter.
-
Ruby Environment Variables: This chapter lists all the important environment variables, which are set so that the Ruby interpreter works.
Popular Ruby Editors
To write Ruby programs, you need an editor:
- If you are writing on Windows, you can use any simple text editor, such as VSCode or Edit Plus.
- VIM(Vi IMproved) is a simple text editor available on almost all Unix systems, and now also on Windows. In addition, you can use your favorite vi editor to write Ruby programs.
- RubyWin is a Ruby integrated development environment (IDE) for Windows.
- Ruby Development Environment (RDE) is also a good integrated development environment (IDE) for Windows users.
Interactive Ruby (IRb)
Interactive Ruby (IRb) provides a shell for experimentation. Inside the IRb shell, you can see the result of interpretation immediately, line by line.
This tool comes automatically with the Ruby installation, so you don't need to do anything extra for IRb to work.
Simply type at the command prompt irb, and an interactive Ruby session will begin, as shown below:
$irb
irb 0.6.1(99/09/16)
irb(main):001:0> def hello
irb(main):002:1> out = "Hello World"
irb(main):003:1> puts out
irb(main):004:1> end
nil
irb(main):005:0> hello
Hello World
nil
irb(main):006:0>
Here you don't need to worry about what the above command does; we will explain it in later chapters.
What's Next?
Assuming you have now set up the Ruby environment and are ready to write your first Ruby program. In the next chapter we will explain how to write Ruby programs.