## Ruby ### Installation Now, you are ready to install the latest [ruby](https://www.ruby-lang.org/en/) version and set it as the default version. Run this command, it will **take a while (5-10 minutes)** ```bash rbenv install ``` Once the ruby installation is done, run this command to tell the system to use the version by default. ```bash rbenv global ``` **Reset** your terminal and check your Ruby version: ```bash exec zsh ``` Then run: ```bash ruby -v ``` :heavy_check_mark: If you see something starting with `ruby ` then you can proceed :+1: :x: If not, **ask a teacher** ### Installing some gems
If you are in China 🇨🇳 click here :warning: If you are in China, you should update the way we'll install gem with the following commands. ```bash # China only! gem sources --remove https://rubygems.org/ gem sources -a https://gems.ruby-china.com/ gem sources -l # *** CURRENT SOURCES *** # https://gems.ruby-china.com/ # Ruby-china.com must be in the list now ```
**Everyone, in China or not**, continue here to install gems. In the ruby world, we call external libraries `gems`: they are pieces of ruby code that you can download and execute on your computer. Let's install some! First, we'll update `bundler`, which is what lets us install gems: ```bash gem update bundler ``` In your terminal, copy-paste the following command: ```bash gem install ``` :heavy_check_mark: If you get `xx gems installed`, then all good :+1: :x: If you encounter the following error: ```bash ERROR: While executing gem ... (TypeError) incompatible marshal file format (can't be read) format version 4.8 required; 60.33 given ``` Run the following command: ```bash rm -rf ~/.gemrc ``` Rerun the command to install the gems. :warning: **NEVER** install a gem with `sudo gem install`! Even if you stumble upon a Stackoverflow answer (or the terminal) telling you to do so.