Friday, 1 June 2018

How to fix kernel_require.rb:55:in `require': cannot load such file -- xcodeproj (LoadError)

Problem:

When I try to build and deploy in XCode 9.3, I get the following error related to: "kernel_require.rb:55:in `require': cannot load such file -- xcodeproj (LoadError)"

/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- xcodeproj (LoadError)
 from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
 from /Development/ELD.iOS/ELD/Scripts/generate_resources.rb:4:in `
' Command /bin/sh failed with exit code 1

Possible solutions to try:

There are several possible ways to address this issue. Two are listed here to try.

  1. Install XCode command line tools from Apple
  2. Install the gem "xcodeproj"

To install XCode command line tools...

  1. Go to https://developer.apple.com/download/more/ and login
  2. Search for the command line tools for your version of XCode, download it, then install it.

To instead install the gem "xcodeproj"...

  1. Open a Terminal window
  2. Use the command:
    sudo gem install xcodeproj

Notes:

This how-to was tested to work for a project on macOS High Sierra 10.13.4 and XCode 9.3. Your results may vary. It assumes a little working knowledge of XCode and Terminal.

Best of luck!