Rails 5.2.0 with Ruby 2.5.1 console - `warning:` `already` initialized constant FileUtils::VERSION : <p>I'm currently experiencing an issue with my new rails application, more specifically:</p>

<ul>
<li>Rails 5.2.0</li>
<li>Ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]</li>
<li>rvm 1.29.4 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [<a href="https://rvm.io]" rel="noreferrer">https://rvm.io]</a></li>
</ul>

<p>When I run <code>rails c</code>, it produces a warning links to fileutils gem as the following:</p>

<pre><code>`/usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/fileutils.rb:90:` `warning:` `already` initialized constant FileUtils::VERSION
/usr/local/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:92: warning: previous definition of VERSION was here
/usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/fileutils.rb:1188: warning: already initialized constant FileUtils::Entry_::S_IF_DOOR
/usr/local/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1267: warning: previous definition of S_IF_DOOR was here
/usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/fileutils.rb:1446: warning: already initialized constant FileUtils::Entry_::DIRECTORY_TERM
/usr/local/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1541: warning: previous definition of DIRECTORY_TERM was here
/usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/fileutils.rb:1448: warning: already initialized constant FileUtils::Entry_::SYSCASE
/usr/local/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1543: warning: previous definition of SYSCASE was here
/usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/fileutils.rb:1501: warning: already initialized constant FileUtils::OPT_TABLE
/usr/local/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1596: warning: previous definition of OPT_TABLE was here
/usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/fileutils.rb:1555: warning: already initialized constant FileUtils::LOW_METHODS
/usr/local/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1650: warning: previous definition of LOW_METHODS was here
/usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/fileutils.rb:1562: warning: already initialized constant FileUtils::METHODS
/usr/local/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1657: warning: previous definition of METHODS was here
</code></pre>

<p>I follow all the step as outlined in this guideline <code>http://railsapps.github.io/installrubyonrails-mac.html</code>.</p>

<p>You can replicate the issue by just following the guideline or with the following steps:</p>

<ol>
<li>rvm install ruby-2.5.1</li>
<li>rails new app</li>
<li>cd app</li>
<li>gem update</li>
<li>bundle update</li>
</ol>

<p>After observing and working around, I've found that the default version of fileutils come with Ruby 2.5.* is 1.0.2 and the <code>gem update</code> command installs a another newer version 1.1.0. Therefore, there are two versions of <code>fileutils</code> are loaded when I run the <code>rails c</code>. </p>

<p>To deal with this issue, I append <code>--default</code> option to the <code>gem update</code> command. </p>

<pre><code>gem update --default
</code></pre>

<p>As a result, I got two default versions which can be seen by running <code>gem list | grep fileutils</code>. This is the only way I can get rid the warning.</p>

<pre><code>mac: gem list | grep fileutils
fileutils (default: 1.1.0, default: 1.0.2)
</code></pre>

<p>I write this question with, kind of, answer just to share with someone who may experience the same issue. I spent hours to sort it out as I couldn't find any helps on the internet.</p>

<p><strong><em>Note</em></strong>: the same issue happens when I use <code>rbenv</code> instead of <code>rvm</code> on macOS Sierra.</p>

<p>Please let me know if anyone has a better approach to deal with such an issue.</p>

<p>Cheers,</p>
