How to Install Gems in Ruby on Rails2:21 with Jason Seifer
A Ruby gem is a library you can use in your Ruby applications. It's really easy to install a gem. You just need to know the name of the gem you want to install. In this Treehouse Quick Tip, Ruby teacher Jason shows you how to install the Bundler gem.
This video doesn't have any notes.
[treehouse presents] 0:00 [Quick Tips] [How to Install Gems in Ruby on Rails] [by Jason Seifer] 0:03 Hi, I'm Jason. 0:06 In this treehouse quick tip, we're going to talk about how to install Ruby gems. 0:07 A Ruby gem is a library that you can use in your Ruby applications. 0:11 It's really easy to install a gem. 0:15 You just need to know the name of the gem that you want to install. 0:18 In this example, I'm going to install the Bundler gem. 0:21 The way to install a gem is by typing the word "gem" followed by a space 0:25 followed by the word "install" and then the name of the gem that you want to install. 0:31 I'm going to install the Bundler gem. 0:36 After that, press "enter" and then Ruby gems will go out, download the proper gem, 0:38 and install it onto your system. 0:43 If you get a message about not having the proper permissions to install a gem, 0:45 you can use the "sudo" command to install the correct gem. 0:50 You would use the "sudo" command on systems where your version of Ruby is installed 0:54 globally rather than on a system like RVM or RBN where you can install gems locally 1:00 to your own home directory. 1:06 I'm going to install another gem called Money. 1:08 The gem install command will also install any needed dependencies of a gem. 1:14 For example, the Money gem requires the i18n gem and also the json gems. 1:18 Once you install a gem, it's really easy to use. 1:24 First, require Ruby gems, then you can also require the gem that you just installed. 1:27 And there you go. 1:36 There's one other way to install gems, and that would be from a gem file. 1:37 A gem file will be in a Ruby on Rails application or actually any Ruby application 1:42 that uses Bundler. 1:48 You specify the gem dependencies in the gem file, and then once you do that, 1:49 you can type the word "bundle install" and then Bundler will go through and install 1:54 all of these gems for you. 2:01 As you can see, it's very easy to install and use Ruby gems. 2:09 The hardest part is finding good ones to install. 2:12 Luckily, there are sites like RubyGems.org and GitHub for that. 2:15 Happy coding! 2:19
You need to sign up for Treehouse in order to download course files.Sign up