SIGN IN SIGN UP
lewagon / setup UNCLAIMED

Setup instructions for Le Wagon's students on their first day of AI Software Development Bootcamp

0 0 0 Ruby
2021-06-18 09:53:14 +02:00
## Ruby
### Installation
2021-06-21 16:05:07 +02:00
Now, you are ready to install the latest [ruby](https://www.ruby-lang.org/en/) version and set it as the default version.
2014-12-26 22:02:47 +01:00
2015-05-04 13:28:19 +02:00
Run this command, it will **take a while (5-10 minutes)**
2014-12-26 22:02:47 +01:00
```bash
rbenv install <RUBY_SETUP_VERSION>
2015-05-04 13:28:19 +02:00
```
Once the ruby installation is done, run this command to tell the system
to use the <RUBY_SETUP_VERSION> version by default.
2015-05-04 13:28:19 +02:00
```bash
rbenv global <RUBY_SETUP_VERSION>
2014-12-26 22:02:47 +01:00
```
2022-01-07 14:33:41 +01:00
**Reset** your terminal and check your Ruby version:
2015-01-05 11:21:00 +01:00
2014-12-26 22:02:47 +01:00
```bash
2022-01-06 16:45:44 +01:00
exec zsh
```
2022-01-07 14:33:41 +01:00
Then run:
```bash
2016-04-18 11:34:39 +02:00
ruby -v
2014-12-26 22:02:47 +01:00
```
:heavy_check_mark: If you see something starting with `ruby <RUBY_SETUP_VERSION>` then you can proceed :+1:
2021-06-18 16:26:05 +02:00
:x: If not, **ask a teacher**
2014-12-26 22:02:47 +01:00
2021-06-18 09:53:14 +02:00
### Installing some gems
2017-02-02 18:35:46 +01:00
2020-10-03 22:56:41 +02:00
<details>
2022-04-06 19:02:14 +02:00
<summary>If you are in <bold>China</bold> 🇨🇳 click here</summary>
2020-10-03 22:56:41 +02:00
:warning: If you are in China, you should update the way we'll install gem with the following commands.
2017-02-02 18:35:46 +01:00
```bash
# China only!
2017-02-02 18:35:46 +01:00
gem sources --remove https://rubygems.org/
2018-10-08 15:10:42 +08:00
gem sources -a https://gems.ruby-china.com/
2017-02-02 18:35:46 +01:00
gem sources -l
# *** CURRENT SOURCES ***
2018-10-08 15:10:42 +08:00
# https://gems.ruby-china.com/
# Ruby-china.com must be in the list now
2017-02-02 18:35:46 +01:00
```
2020-10-03 22:56:41 +02:00
</details>
2017-02-02 18:35:46 +01:00
**Everyone, in China or not**, continue here to install gems.
2021-06-18 16:26:05 +02:00
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
```
2021-06-18 16:26:05 +02:00
In your terminal, copy-paste the following command:
2017-02-02 18:35:46 +01:00
2014-12-26 22:02:47 +01:00
```bash
gem install <GEMS>
2014-12-26 22:02:47 +01:00
```
2015-03-07 16:49:37 +01:00
:heavy_check_mark: If you get `xx gems installed`, then all good :+1:
2020-06-12 10:36:32 +01:00
2021-06-18 10:07:13 +02:00
:x: If you encounter the following error:
```bash
2020-06-12 10:36:32 +01:00
ERROR: While executing gem ... (TypeError)
incompatible marshal file format (can't be read)
format version 4.8 required; 60.33 given
2021-06-18 10:07:13 +02:00
```
2020-06-12 10:36:32 +01:00
Run the following command:
```bash
rm -rf ~/.gemrc
```
Rerun the command to install the gems.
2021-06-18 16:26:05 +02:00
: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.