Elye
Elye

Reputation: 60251

pod init cause RuntimeError - [Xcodeproj] Unknown object version

When I run pod init, I got the following error.

RuntimeError - [Xcodeproj] Unknown object version.
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.19.0/lib/xcodeproj/project.rb:227:in `initialize_from_file'
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.19.0/lib/xcodeproj/project.rb:112:in `open'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command/init.rb:41:in `validate!'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:333:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

Upvotes: 57

Views: 25081

Answers (7)

Bhavnish
Bhavnish

Reputation: 102

To fix this, open the Xcode project, navigate to the utility panel on the right side, and set the project version to be compatible with Xcode 10.0. That should resolve the issue.

enter image description here

Upvotes: 0

MGY
MGY

Reputation: 8523

Problem

The real problem is the Xcode version does not match up with your cocoapods version. The command could be pod init or pod install, you'll face with the same error as the original question shared.

Solutions

I've faced this issue multiple times, so I'll be sharing all the different scenarios that I've faced in the past couple of years.

First

Open the .xcodeproj. Navigate to Project Navigator > Click the root project, check the right-hand panel > Find Identity and type.

Over there, change the project format to any version lower than the latest version.

Second

You need to first run the:

gem update xcodeproj

If the update operation does not fix your problem, then you have to run:

gem uninstall xcodeproj

and then:

gem install xcodeproj

Third

I've another Mac machine that I didn't update anything on the terminal for a long time. In that machine, the solution was different than the solutions listed above. I've tried all of them but didn't work for me. My only solution was the uninstall and reinstall the cocoapods itself. First run:

sudo gem uninstall cocoapods

then run:

sudo gem install cocoapods

I hope this answer will collect all the possible solutions for the case. If you've experienced an alternative scenario please let me know in the comments below.

Upvotes: 3

ferhat geyik
ferhat geyik

Reputation: 1

gem install --user-install cocoapods
echo 'export PATH="$HOME/.gem/ruby/2.6.0/bin:$PATH"' >> ~/.bashrc
and restart terminal
source ~/.bashrc

Then go to your project directory and write pod init.

Upvotes: 0

Prathamesh Salawkar
Prathamesh Salawkar

Reputation: 11

I got this error because podfile not created correctly.

I have created podfile as touch podfile instead of touch Podfile After researching log found that Podfile should start with capital.

Hope this helps!!

Upvotes: 0

one1color
one1color

Reputation: 201

I initially tried this: sudo gem update xcodeproj

If it did not work (that was my case):

brew uninstall cocoapods

then

sudo gem install cocoapods

after that

pod init

This worked for me!

Upvotes: 16

Denis
Denis

Reputation: 3353

I've got very similar error: RuntimeError - [Xcodeproj] Unknown object version (56).

It turns out the cocopapods doesn't know how to work with Xcode 14 project version properly and it complains instead.

To solve the issue, open Xcode project on the right side utility panel and change the project version to Xcode 13.0 - compatible and you are good to go.

Changing Xcode version to Xcode 13.0 to fix cocoapods issue about object version 56

Upvotes: 116

Elye
Elye

Reputation: 60251

After investigation, I found I need to run

sudo gem update xcodeproj 

Then run

pod init

Upvotes: 94

Related Questions