1 00:00:00,000 --> 00:00:04,537 [MUSIC] 2 00:00:04,537 --> 00:00:07,253 Hi, I'm Jay, a teacher here at Tree House. 3 00:00:07,253 --> 00:00:10,370 Today we're going to be setting up a Ruby on Rails development environment 4 00:00:10,370 --> 00:00:11,790 on your Mac. 5 00:00:11,790 --> 00:00:15,360 We'll use Homebrew, a software package installer to install some libraries that 6 00:00:15,360 --> 00:00:17,370 both Ruby on Rails rely on. 7 00:00:17,370 --> 00:00:22,630 Then we use RVM, the Ruby Version Manager, to install a new version of Ruby. 8 00:00:22,630 --> 00:00:25,120 Macs already come with a version of Ruby installed but 9 00:00:25,120 --> 00:00:27,125 it's usually a little out of date. 10 00:00:27,125 --> 00:00:31,390 RVM will install an up to date version alongside your existing version. 11 00:00:31,390 --> 00:00:36,560 Lastly we'll use our newly installed Ruby tools to install the Rails library itself. 12 00:00:36,560 --> 00:00:40,140 We've tried to make this guide applicable for as many people as possible but 13 00:00:40,140 --> 00:00:43,220 small tweaks may be needed to get your system working. 14 00:00:43,220 --> 00:00:45,800 Be sure to check the teacher's notes for additional hints. 15 00:00:45,800 --> 00:00:49,740 And if you get stuck try asking your question in the Tree House community. 16 00:00:49,740 --> 00:00:51,630 If you're getting an error message, copy and 17 00:00:51,630 --> 00:00:55,040 paste that into your post as you'll get help more quickly that way. 18 00:00:55,040 --> 00:00:55,630 Ready? 19 00:00:55,630 --> 00:00:56,290 Let's get started. 20 00:00:58,070 --> 00:00:59,890 First you'll need to open a terminal. 21 00:00:59,890 --> 00:01:04,190 If you haven't done this before, visit your Applications folder in the Finder. 22 00:01:04,190 --> 00:01:06,673 Then open the Utilities folder. 23 00:01:06,673 --> 00:01:08,380 And then double-click the Terminal lab. 24 00:01:09,590 --> 00:01:13,560 Installing Rails requires several software packages and Homebrew, the package 25 00:01:13,560 --> 00:01:17,330 manager, can automatically download and install these packages for us. 26 00:01:17,330 --> 00:01:19,740 So, let's start by installing Homebrew. 27 00:01:19,740 --> 00:01:22,390 In a search engine, search for Homebrew. 28 00:01:22,390 --> 00:01:25,560 You're looking for the package manager so click that link. 29 00:01:25,560 --> 00:01:29,290 You'll see a Ruby command that you need to copy and paste into your terminal. 30 00:01:29,290 --> 00:01:32,540 Macs actually come with a version of Ruby pre-installed. 31 00:01:32,540 --> 00:01:36,280 It's a bit outdated, but it's recent enough to install Homebrew for us. 32 00:01:36,280 --> 00:01:37,260 So select the command. 33 00:01:38,990 --> 00:01:40,390 Copy it. 34 00:01:40,390 --> 00:01:43,300 Now paste the terminal into your command and hit Enter to run it. 35 00:01:43,300 --> 00:01:45,280 It will ask you to confirm. 36 00:01:45,280 --> 00:01:47,120 So just press Return. 37 00:01:47,120 --> 00:01:48,989 And you'll need to type your system password. 38 00:01:56,920 --> 00:02:00,070 Now it's time to install our first Homebrew package. 39 00:02:00,070 --> 00:02:04,030 For security reasons we're going to need an encryption tool named GPG. 40 00:02:04,030 --> 00:02:05,790 So let's install that. 41 00:02:05,790 --> 00:02:09,497 In your terminal type brew install gpg. 42 00:02:14,413 --> 00:02:18,630 And now we're ready to install RVM the Ruby Version Manager. 43 00:02:18,630 --> 00:02:22,970 RVM will download, compile and install new Ruby versions for us. 44 00:02:22,970 --> 00:02:25,560 In a search engine search for our RVM. 45 00:02:26,930 --> 00:02:28,510 It'll probably be the first result. 46 00:02:29,910 --> 00:02:34,090 Scroll down a bit and you'll see a pair of commands that you need to copy and 47 00:02:34,090 --> 00:02:36,000 paste into your terminal. 48 00:02:36,000 --> 00:02:37,970 Highlight the gpg command. 49 00:02:37,970 --> 00:02:41,620 Don't include the dollar sign at the start as that's meant to represent you system 50 00:02:41,620 --> 00:02:42,880 command prompt. 51 00:02:42,880 --> 00:02:46,580 Now Copy and then Paste the command into your terminal. 52 00:02:46,580 --> 00:02:48,579 Hit Return and wait for the command to complete. 53 00:02:50,390 --> 00:02:54,590 Now for the second command, go back to your browser, select the second command, 54 00:02:54,590 --> 00:02:56,150 again without the dollar sign. 55 00:02:56,150 --> 00:02:58,720 Copy and paste into your terminal. 56 00:02:58,720 --> 00:02:59,430 Hit Enter to run. 57 00:03:02,895 --> 00:03:04,180 RVM is now installed but 58 00:03:04,180 --> 00:03:07,190 it won't be available until you open a new terminal window. 59 00:03:07,190 --> 00:03:13,400 So go ahead and go into your menu and choose to open a new window. 60 00:03:13,400 --> 00:03:17,130 You can confirm that your ruby installation is successful by typing ruby 61 00:03:17,130 --> 00:03:18,860 –v at the prompt. 62 00:03:18,860 --> 00:03:20,730 It should bring up the Ruby version. 63 00:03:20,730 --> 00:03:22,380 Okay, Ruby is installed. 64 00:03:22,380 --> 00:03:24,560 Now it's time to install Rails. 65 00:03:24,560 --> 00:03:26,490 Rails comes as a Ruby gem. 66 00:03:26,490 --> 00:03:29,740 A gem is a library, a collection of reusable code. 67 00:03:29,740 --> 00:03:31,950 Gems can be automatically downloaded and 68 00:03:31,950 --> 00:03:34,940 installed on your system using the gem tool. 69 00:03:34,940 --> 00:03:38,100 In your command prompt type gem install 70 00:03:38,100 --> 00:03:41,040 followed by the name of the gem we want which is rails. 71 00:03:41,040 --> 00:03:42,810 But don't run the command yet. 72 00:03:42,810 --> 00:03:45,490 If you want to simply install the latest version of Rails 73 00:03:45,490 --> 00:03:48,360 whatever it was you could just hit Return here. 74 00:03:48,360 --> 00:03:51,810 But we want to specify a particular version of Rails to install to make sure 75 00:03:51,810 --> 00:03:56,290 that all the code we show you during the upcoming courses will work the same way. 76 00:03:56,290 --> 00:04:05,710 So, we're going to add --version 5.0.0 onto the end of the command. 77 00:04:05,710 --> 00:04:10,561 Once you press Return, the gem program will download and install version 5.0.0 78 00:04:10,561 --> 00:04:14,740 of the Rails gem along with all the other gems Rails depends on. 79 00:04:14,740 --> 00:04:16,740 There's a lot of them so be patient. 80 00:04:16,740 --> 00:04:19,810 You'll know the installation is done when you see your system prompt again. 81 00:04:24,109 --> 00:04:25,066 And that's it. 82 00:04:25,066 --> 00:04:27,590 You should be ready to create your first Rails app.