---
title: "Ruby 2.5 requires pp by default"
description: "No need to require pp separately now, it is required'd by default"
canonical_url: "https://www.bigbinary.com/blog/ruby-2-5-requires-pp-by-default"
markdown_url: "https://www.bigbinary.com/blog/ruby-2-5-requires-pp-by-default.md"
---

# Ruby 2.5 requires pp by default

No need to require pp separately now, it is required'd by default

- Author: Prathamesh Sonpatki
- Published: December 20, 2017
- Categories: Ruby 2.5, Ruby

Ruby 2.5.0-preview1 was recently
[released](https://www.ruby-lang.org/en/news/2017/10/10/ruby-2-5-0-preview1-released/).

Ruby allows pretty printing of objects using
[pp method](http://ruby-doc.org/stdlib-2.4.0/libdoc/pp/rdoc/PP.html).

Before Ruby 2.5, we had to require PP explicitly before using it. Even the
official documentation states that "All examples assume you have loaded the PP
class with require 'pp'".

```ruby
>> months = %w(January February March)
=> ["January", "February", "March"]

>> pp months
NoMethodError: undefined method `pp' for main:Object
Did you mean?  p
	from (irb):5
	from /Users/prathamesh/.rbenv/versions/2.4.1/bin/irb:11:

>> require 'pp'
=> true

>> pp months
["January",
 "February",
 "March"]
=> ["January", "February", "March"]
```

In Ruby 2.5, we don't need to require pp. It
[gets required by default](https://bugs.ruby-lang.org/issues/14123). We can use
it directly.

```ruby
>> months = %w(January February March)
=> ["January", "February", "March"]

>> pp months
["January",
 "February",
 "March"]
=> ["January", "February", "March"]
```

This feature was added after Ruby 2.5.0 preview 1 was released, so it's not
present in the preview. It's present in
[Ruby trunk](https://github.com/ruby/ruby).

## Links

- [Human page](https://www.bigbinary.com/blog/ruby-2-5-requires-pp-by-default)
