Is / etc / irbrc installed by OS X? Does it read irb?

When investigating an irb problem on my Mac (OS X 10.11.5), I noticed /etc/irbrc . The first few lines follow:

 # Some default enhancements/settings for IRB, based on # http://wiki.rubygarden.org/Ruby/page/show/Irb/TipsAndTricks unless defined? ETC_IRBRC_LOADED # Require RubyGems by default. require 'rubygems' # Activate auto-completion. require 'irb/completion' # continued ... 

It seems that this is deprecated (rubygarden.org is gone, rubigems are now in the standard library) and does what I always thought I should have done in my own ~/.irbrc (configure completion, history, etc.).

It is dated January 31, 2016. Perhaps I could or could not start updating the Apple system or update something else on that date; I do not remember. Since then, I have definitely upgraded OS X with a major version or two.

I do not think that I have Rubies on this computer, other than this, from OS X and Ruby 2.3.1 installed using rbenv (in my account, not root). That is, I do not think this file could have come from anything other than OS X.

The Unix shell convention would have led me to have a file named /etc/irbrc execute when any user runs irb before their ~/.irbrc , if any. However, the irb installed by OS X does not seem to read this file: I put puts 1 at the top and cannot see the result when irb starts. (I usually use rbenv, but disabled it when examining this file.) /etc/irbrc does not work, regardless of whether I have ~/.irbrc . In addition, I do not see references to this file in /usr/bin/irb or /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb .

I assume this file

  • OS X is installed
  • irb as cannot be read (despite its misleading name and location), but is intended to be copied to ~/.irbrc .

Does anyone know for sure or know something else?

I do not need or do not need it; I am happy to keep my own ~/.irbrc . I just want to make sure that this does not affect irb when I run it (in particular, irb in the Rbenv-installed Ruby, which I usually use), and that future OS X updates will not change the behavior of irb.

+4
ruby irb macos
Jun 03 '16 at 14:51
source share
1 answer

On the Setchell and Jared Beck brands, the / etc / irbrc comments are installed with the current (10.13) OS X and were for at least a few major releases.

I copied / etc / irbrc to ~ / .irbrc, ran irb, exited and got an error: undefined method 'nitems' for ["exit"]:Array (NoMethodError) . This method existed in Ruby 1.8, but was removed from Ruby 1.9. I usually do not see this error, so I came to the conclusion that / etc / irbrc is not running at all.

In general, I came to the conclusion that when debugging problems with my ~ / .irbrc, I could ignore / etc / irbrc, which was the reason for my question.

+4
Jun 14 '16 at 19:20
source share



All Articles