Ruby environment


Local environment settings

If you want to set up the environment for the Ruby programming language, please read this chapter. This chapter will teach you all the important topics related to environment setup. It is recommended to study the following topics first before delving further into other topics:

  • Ruby Installation on Linux/Unix: If you want to configure a development environment on Linux/Unix, then Please review the contents of this chapter.

  • Ruby installation on Windows: If you want to configure a development environment on Windows, check out this section.

  • Ruby Command Line Options: This section lists all the command line options you can use with the Ruby interpreter.

  • Ruby Environment Variables: This section provides a list of all important environment variables that are set to make the Ruby interpreter work.

Popular Ruby Editors

In order to write Ruby programs, you need an editor:

  • If you are To write on Windows, you can use any simple text editor such as Notepad or Edit plus.

  • VIM (Vi IMproved) is a simple text editor available on almost all Unix and now also on Windows. Alternatively, 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 the experience. Within the IRb shell, you can immediately view the results of the interpretation line by line.

This tool comes automatically with Ruby installation, so you don't need to do anything extra for IRb to work normally.

Just type irb in the command prompt, and an interactive Ruby Session will start, 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>

You don’t need to worry about the above commands here. We will explain to you the execution content in subsequent chapters.

What will you learn next?

Assume that you have now set up your Ruby environment and are ready to write your first Ruby program. In the next chapter we'll show you how to write Ruby programs.