English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Ruby Environment

Local environment setup

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

  • Linux/Ruby installation on Unix: If you want to configure on Linux/If you want to configure the development environment on Unix, please refer to the content of this chapter.

  • Ruby installation on Windows: If you want to configure the development environment on Windows, please refer to the content of this chapter.

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

  • Ruby Environment Variables: This chapter lists all important environment variables, setting these environment variables to make the Ruby interpreter work.

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 Notepad or Edit plus.
  • VIMVIM is a simple text editor that is almost available on all Unix systems and is now also available on Windows. In addition, you can also use your favorite vi editor to write Ruby programs.
  • RubyWin It is an integrated development environment (IDE) for Ruby targeted at Windows.
  • Ruby Development Environment (RDE) It is also a good integrated development environment (IDE) for Windows users.

Interactive Ruby (IRb)

Interactive Ruby (IRb) provides a shell for experience. In the IRb shell, you can immediately view the interpreted results line by line.

This tool comes with Ruby automatically upon installation, so you don't need to do anything else; IRb will work normally.

You just need to type in the command prompt irbAn interactive Ruby session will start as follows:

$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 can ignore the execution content of the above command for the time being; we will explain it to you in subsequent chapters.

What will we learn next?

Assuming you have already set up the Ruby environment and are ready to write your first Ruby program. In the next chapter, we will explain how to write a Ruby program.