title: Can not install Cocoapods with RubyGem 2.7.1
body: <p>My Cocoapods did not work, therefore I did the following command:</p>
  
  <ol>
  <li><p>run this bash script to remove all the relevant gems:</p>
  
  <pre><code>for i in $( gem list --local --no-version | grep cocoapods );
  do 
      sudo gem uninstall $i; 
  done
  </code></pre></li>
  <li><p>delete ~/.cocoapods to remove the cache of podspecs.:</p>
  
  <pre><code>rm -rf ~/.cocoapods/
  </code></pre></li>
  <li><p>update rubygem:</p>
  
  <pre><code>sudo gem update --system
  </code></pre></li>
  <li><p>reinstall cocoapods:</p>
  
  <pre><code>sudo gem install cocoapods
  </code></pre></li>
  </ol>
  
  <p>Then I got file permission deny error message in Step3 and Step 4:</p>
  
  <blockquote>
    <p>Step3 error message:<br>
        ...<br>
        ...<br>
        Done installing documentation for rubygems-update after 0 seconds<br>
        Installing RubyGems 2.7.1<br>
        ERROR:  While executing gem ... (Errno::EPERM)<br>
            Operation not permitted @ rb_sysopen - 
        /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/gem</p>
    
    <p>Step4 error message:<br>
        Fetching: cocoapods-core-1.3.1.gem (100%)<br>
        Successfully installed cocoapods-core-1.3.1<br>
        Fetching: cocoapods-deintegrate-1.0.1.gem (100%)<br>
        Successfully installed cocoapods-deintegrate-1.0.1<br>
        Fetching: cocoapods-downloader-1.1.3.gem (100%)<br>
        Successfully installed cocoapods-downloader-1.1.3<br>
        Fetching: cocoapods-plugins-1.0.0.gem (100%)<br>
        Successfully installed cocoapods-plugins-1.0.0<br>
        Fetching: cocoapods-search-1.0.0.gem (100%)<br>
        Successfully installed cocoapods-search-1.0.0<br>
        Fetching: cocoapods-stats-1.0.0.gem (100%)<br>
        Successfully installed cocoapods-stats-1.0.0<br>
        Fetching: cocoapods-trunk-1.3.0.gem (100%)<br>
        Successfully installed cocoapods-trunk-1.3.0<br>
        Fetching: cocoapods-try-1.1.0.gem (100%)<br>
        Successfully installed cocoapods-try-1.1.0<br>
        ERROR:  While executing gem ... (Gem::FilePermissionError)
            You don't have write permissions for the /usr/bin directory.</p>
  </blockquote>
  
  <p>I have limited knowledge about Linux/OSX file sysem, and do not know what was wrong.</p>
  
  <p>Here are information about my computer:</p>
  
  <ol>
  <li><p>OS: </p>
  
  <p>macOS High Sierra 10.13.1</p></li>
  <li><p>Xcode:</p>
  
  <p>Version 9.0.1 (9A1004)<br>
  I also have XCode 7.3.1 renamed as Xcode_7 in the Applications Folder</p></li>
  <li><p>Environment path:</p>
  
  <pre><code>echo $PATH
  </code></pre>
  
  <p>/Library/Frameworks/Python.framework/Versions/3.4/bin:<br>
  /usr/local/bin:<br>
  /usr/bin:<br>
  /bin:<br>
  /usr/sbin:<br>
  /sbin:<br>
  /opt/X11/bin:<br>
  /Applications/Server.app/Contents/ServerRoot/usr/bin:<br>
  /Applications/Server.app/Contents/ServerRoot/usr/sbin  </p></li>
  <li><p>Homebrew:</p>
  
  <pre><code>brew --version
  </code></pre>
  
  <p>Homebrew 1.3.6<br>
  Homebrew/homebrew-core (git revision 985b; last commit 2017-11-07)</p>
  
  <pre><code>brew list
  </code></pre>
  
  <p>cmake       libxml2     ninja       pkg-config  readline    wget
  gdbm        libyaml     openssl     python3     sqlite      xz</p></li>
  <li><p>RubyGems:</p>
  
  <pre><code>gem --version
  </code></pre>
  
  <p>2.7.1  </p>
  
  <pre><code>gem list
  </code></pre>
  
  <p><strong>* LOCAL GEMS *</strong><br>
  activesupport (5.1.4, 4.2.10)<br>
  bigdecimal (1.3.2, default: 1.2.8)<br>
  CFPropertyList (2.3.5, 2.2.8)<br>
  claide (1.0.2)<br>
  colored2 (3.1.2)<br>
  concurrent-ruby (1.0.5)<br>
  did_you_mean (1.0.0)<br>
  escape (0.0.4)<br>
  fourflusher (2.0.1)<br>
  fuzzy_match (2.1.0, 2.0.4)<br>
  gh_inspector (1.0.3)<br>
  i18n (0.9.1)<br>
  io-console (0.4.6, default: 0.4.5)<br>
  json (2.1.0, default: 1.8.3)<br>
  libxml-ruby (3.0.0, 2.9.0)<br>
  mini_portile2 (2.3.0)<br>
  minitest (5.10.3)<br>
  molinillo (0.6.4, 0.5.7)<br>
  nanaimo (0.2.3)<br>
  nap (1.1.0)<br>
  net-telnet (0.1.1)<br>
  netrc (0.11.0)<br>
  nokogiri (1.5.6)<br>
  power_assert (1.1.1)<br>
  psych (2.2.4, default: 2.1.0)<br>
  rake (12.2.1, 10.4.2)<br>
  rdoc (5.1.0, default: 4.2.1)<br>
  ruby-macho (1.1.0)<br>
  rubygems-update (2.7.1)<br>
  sqlite3 (1.3.11)<br>
  test-unit (3.2.6)<br>
  thread_safe (0.3.6)<br>
  tzinfo (1.2.4)<br>
  xcodeproj (1.5.3)  </p></li>
  </ol>