pod init cause RuntimeError - [Xcodeproj] Unknown object version
Asked Answered
F

6

52

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>'
Firework answered 20/3, 2022 at 11:12 Comment(1)
any update about that?Comedown
D
115

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

Dimer answered 12/9, 2022 at 23:10 Comment(4)
This worked for me, just updated XCode yesterday and creating a new project it's crashing - not goodEndocrinology
This seems to be the only thing that works. Thank youFeucht
The only useful answer I found on the entire internet. Thanks mate.Prothalamium
Did not work for me. I had to do sudo gem update xcodeproj and then pod initFloccule
F
92

After investigation, I found I need to run

sudo gem update xcodeproj 

Then run

pod init
Firework answered 20/3, 2022 at 11:13 Comment(4)
this solution not work for me.Comedown
Same. Updated xcodeproj, but still doesn't work. P.S. There is a temporary workaround - set objectVersion to 55 in project.pbxproj. Keep in mind, that it will be updated to 56 by Xcode if anything changes in the project.Mccutchen
update Xcode project and then pod install worked for me. Thanks!!!Peroxide
Works for me after install cocoapods (1.11.3) and ffi (1.15.5) on MacOS 12.6 (M1).Defluxion
C
15

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!

Craft answered 21/10, 2022 at 14:2 Comment(0)
A
2

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.

Appliance answered 24/2 at 13:27 Comment(2)
Thanks man, the second one worked for me!Caslon
Dreft, glad to hear!Appliance
A
0

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!!

Alkalize answered 8/5, 2023 at 12:18 Comment(0)
F
0
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.

Fondle answered 2/11, 2023 at 20:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.