This page features a collection of some of the best Ruby books for all learning levels.
I will guide through the process of selecting the best Ruby book for you, based on my expertise with the language (programming in it since 2004), my extensive experience with mentoring young programmers, and having reviewed dozens of Ruby books over the years.
Ruby books or Ruby on Rails books?
This page is dedicated to the best Ruby books available on the market as of today; not the best Rails books. If you are new to the Ruby ecosystem, it’s important to understand the difference.
Ruby is a beautiful programming language that can be used for all sort of purposes. Ruby on Rails (Rails, for short) is a highly productive and popular web framework written in Ruby.
You’ll write lots of Ruby code in the process of writing web applications in Rails, so if you are looking into Ruby because of Rails, I highly recommended that you get both a Ruby and a Rails book.
If you never programmed before, you need a Ruby book that doesn’t just teach you the language, but also teaches you how to program. For example, you might need to learn not just the Ruby syntax to work with arrays, but also be explained what arrays are in the first place.
Thankfully you have a couple of very good gentle introductions:
This is a great introduction to Ruby for beginner programmers. It lays down solid foundations for the language, while also nicely introducing the whole Ruby ecosystem. The author, Peter Cooper, is a well-known figure in the Ruby community, and in this Ruby book, he clearly demonstrates his ability to teach and communicate with newcomers. This third edition was released relatively recently (it covers Ruby 2.3) and is comprehensive enough to act as a good, current reference book as well.
This is the fourth edition of the so-called “pickaxe”, the book most Rubyists have used to learn Ruby since 2000. This book acts as a tutorial and reference, and it’s aimed at professional developers, as it’s full of advanced concepts and theoretical explanations that go deeper into the ‘why’ and ‘how’ of Ruby and Agile programming. Not everyone’s cup of tea, but definitely well worth it if you are already quite familiar with object-oriented programming.
If you know some programming, but don’t have at least a couple of years of professional experience under your belt, I’d recommend Beginning Ruby instead. It has also the advantage of being newer and therefore slightly more current. Otherwise, go with Programming Ruby.
Ruby books to take your Ruby skills to the next level
The following list of Ruby books is aimed at programmers who already know Ruby. Whether you know it at a novice level or intermediate level, all will teach you something you don’t already know about Ruby and programming in general.
These intermediate to advanced Ruby books are all excellent follow-ups to the books listed in the previous section.
Approachable guide to the language that doesn’t shy away from more advanced topics or in-depth explanations. As the title implies, this book will make you a well-grounded Rubyist who produces idiomatic code and understands the why behind the how. More experienced developers (in other languages) might even consider starting with this book instead of the ones in the previous section.
It looks like a cookbook and within its pages, you’ll find plenty of HOWTOs for several common tasks. It is, therefore, a valuable book if treated as a cookbook, but that’s not its main purpose. The Ruby Way is about learning how to deal with a variety of programming tasks in an idiomatic manner. This book is about learning to code the Ruby Way.
The first edition of this Ruby book is where David Heinemeier Hansson, creator of Rails, learned most of what he knows about meta-programming and Ruby. I personally consider The Ruby Way to be a definite must-have, it’s chock-full of practical examples and advanced lessons.
If you want to fully grasp object-oriented programming in Ruby, this book will certainly help. Though it came out in 2012, it doesn’t really matter. It remains a great primer on the topic of OOP in Ruby. (You can now pre-order the 2nd edition, which is coming out in August 2018.)
Updated to Ruby 2, this second edition of the Ruby Cookbook is an invaluable tome that should have a sweet spot on your desktop. It provides more than 800 pages of idiomatic Ruby code recipes for common, highly interesting tasks. If you learn by doing, this book alone will be able to give you a great deal of insight into Ruby. Each recipe is thoroughly explained and will always be at hand, ready to help you out if you are stuck with a given problem. It’s not the type of book that you read cover to cover (unless you want to), but it’s a must-have for Ruby programmers of all levels – and one that you’ll use a lot.
I’m a big fan of the Effective series by Addison-Wesley and they certainly did not disappoint with this one. Although some of the 48 “items” presented will appear a bit too basic to some, the book is still full of tips and tricks that will make you a better Ruby programmer.
Published in 2009, this is the only book in the list that genuinely uses an outdated version of Ruby. It is, however, a conceptual book so it doesn’t really matter, and what you’ll learn from it can be applied to any Ruby version (and to a good degree any object-oriented language). Testing and refactoring are key practices within the Ruby community and this book does an excellent job of explaining both the how and why. This book will make you a better programmer, not just a better Ruby programmer.
The title says it all. Ruby is a great language, but it’s not the fastest. It’s optimized for programmer’s happiness over raw computing efficiency. This recently released book will help you understand performance pitfalls and how to squeeze every last bit of speed, from an otherwise somewhat slow language.
One of the most powerful features in Ruby is its metaprogramming prowess. This book fully explores Ruby’s metaprogramming capabilities and does so with clarity and conciseness. At some point in your Ruby career, you’ll want to explore DSL (Domain Specific Languages) or understand how some Ruby on Rails gem manages to pull a certain magic trick. This book will tell you how and show you how powerful and flexible Ruby can really be.
The best and most advanced book on the market to really understand the internals of Ruby. At some point, you really owe yourself to peek behind the curtain. This the book I’d buy as a gift to my friends who are Ruby experts with over a decade of experience.
Some good books were excluded because objectively too obsolete at this point. Too niche Ruby books were not included either.
The books mentioned above are some of what I consider to be the best Ruby books available today, based on my experience, those of my colleagues and possibly the opinions shared by most in the Ruby community. There are plenty of good books published every year, though, and if you’ve bought any of them or intend to buy one, you will probably be very satisfied nevertheless. That said, be aware that amongst the huge number of Ruby books being sold on the shelves at the moment, there are a few bad apples that I wouldn’t recommend at all. I won’t name such titles here but beware and read Amazon reviews if you decide not to stick to my recommendations.
Books are very helpful and you should definitely read them and keep a few on hand for reference. Remember though that in order to succeed at programming, there is no substitute for gaining experience by practicing coding yourself and reading other people’s code as well. They are necessary but not sufficient if you will.
I was one of the contributors to the Ruby Cookbook, but my judgment of that particular book is in no way altered by this fact.