cocoapods-generate icon indicating copy to clipboard operation
cocoapods-generate copied to clipboard

"Unknown command: `gen`" even if latest cocoapods-generate gem is installed.

Open jolasjoe opened this issue 3 years ago • 10 comments

I have the following list of cocoapods related gems installed:

cocoapods (1.11.2)
cocoapods-core (1.11.2)
cocoapods-deintegrate (1.0.5)
cocoapods-disable-podfile-validations (0.1.1)
cocoapods-downloader (1.5.1)
cocoapods-generate (2.2.2)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.1)
cocoapods-trunk (1.6.0)
cocoapods-try (1.2.0)

My ruby version - ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-darwin20] As you can see in the above list cocoapods-generate (2.2.2) is installed. But, when I run pod gen I get


    WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
    Consider adding the following to ~/.profile:

    export LANG=en_US.UTF-8
    
[!] Unknown command: `gen`
Did you mean: env?

I couldn't understand how to apply the solution from Issue 95

Though I tried sudo 'xcode-select --switch /Applications/Xcode.app' as suggested in Issue 95 the issue still persist.

refer: Issue 95 and Issue 84

jolasjoe avatar Oct 19 '21 13:10 jolasjoe

Anything new here? I have to use this plugin because of Kotlin mobile Multiplattform.

Same issue as described for me.

I have following ruby version:

ruby -rrbconfig -e 'puts RbConfig::CONFIG["rubyhdrdir"]'
/opt/homebrew/Cellar/ruby/3.0.3/include/ruby-3.0.0

If I execute pod --version I get always following:

1.11.2

[!] cocoapods-generate requires CocoaPods >= 1.5.0

1.11.2 is much higher than 1.5.0

nilskasseckert avatar Dec 06 '21 09:12 nilskasseckert

Faced the same issue on macOS Big Sur with ruby >3 and default gem install command installs cocoapods-generate 1.4.1

After some investigation, following steps fixed the problem:

  • Installed 2.2.2 of cocoapods-generate using sudo gem install cocoapods-generate -v 2.2.2 as per #95
  • ruby version 3 had issue running above command, so had to downgrade ruby to version 2 (2.6 in my case) before running above command. Refer https://github.com/rubygems/rubygems/issues/4338

krishnakumar4a4 avatar Jan 06 '22 06:01 krishnakumar4a4

Thanks @krishnakumar4a4 for the solution but this can not be way how to solve it.

Especially on the M1 Macs there are only ARM builds of the new versions. Furthermore, you would have to stay on the old version forever.

nilskasseckert avatar Jan 06 '22 07:01 nilskasseckert

Having the same issue at the moment. The pod gen command is not found. I need the command for a Kotlin multiplatform project.

Here's my cocoapods gem list:

cocoapods (1.11.2)
cocoapods-core (1.11.2)
cocoapods-deintegrate (1.0.5)
cocoapods-disable-podfile-validations (0.1.1)
cocoapods-downloader (1.5.1)
cocoapods-generate (2.2.2)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.1)
cocoapods-trunk (1.6.0)
cocoapods-try (1.2.0)

Ruby version: 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21] MacOS: 12.1 (21C52) (Monterey) Machine: MacBook Air (M1, 2020)

Any solutions for this?

AresProductions avatar Feb 17 '22 13:02 AresProductions

The solution to my problem was not actually related to cocoapods-generate itself, but with Brew.

The problem was:

  • I had cocoapods installed in brew
  • When using the pod command, the cocoapods from brew was being used
  • But cocoapods from brew could not use the cocoapods-generate, as it cannot be installed in Brew, (it's in the gem list)

To solve the problem make sure:

  • To run which pod in the terminal, and make sure you're not using cocoapods from brew by default
  • If you do, the easiest solution is to uninstall cocoapods from brew
  • Make sure you have cocoapods installed with gem
  • pod gen should now work for you

Attention: This still requires you to use Ruby < 3.0

AresProductions avatar Feb 17 '22 14:02 AresProductions

Hi @AresProductions, but this only works if you are using the old ruby version. Not the new one (>= 3.0.0)

I meant a completely different problem and unfortunately it is not fixed.

nilskasseckert avatar Feb 17 '22 17:02 nilskasseckert

I had the same error, in my case it was caused by 2 versions of ruby on the system - one I wanted to use 2.7 installed by brew and the one preinstalled in /usr/bin/ruby which was 2.6.

I had cocoapods-generate installed correctly by ruby 2.7 but for some reason cocoapods were installed in 2.6 gems. Try to run pod env and which ruby and compare if the ruby version is the same for both outputs.

After I uninstalled cocoapods from 2.6 and installed into 2.7 cocoapods-generate started to work correctly.

bio007 avatar Aug 11 '22 08:08 bio007

  • Make sure you have cocoapods installed with gem

But installing Cocoapods via Gem gives Errors in M1 systems . Because it needs to run using Arch -x86_64 ... but these things not supported by gradle cocopods.

Anyway to installed cocoa-generate via Homebrew?

RageshAntony avatar Aug 11 '22 11:08 RageshAntony

in progress trying this approach: https://youtrack.jetbrains.com/issue/KT-49418/KMM-Wizard-Android-Studio-BumbleBee-202111-Beta1-Gradle-Build-Failed-As-Soon-As-Completes-Wizard-Due-To-pod-install-Task-Failed#focus=Comments-27-5429773.0-0

retrieved from: https://kotlinlang.slack.com/archives/C3PQML5NU/p1660125428681559?thread_ts=1660052864.994119&cid=C3PQML5NU

mochadwi avatar Aug 26 '22 13:08 mochadwi

in progress trying this approach: https://youtrack.jetbrains.com/issue/KT-49418/KMM-Wizard-Android-Studio-BumbleBee-202111-Beta1-Gradle-Build-Failed-As-Soon-As-Completes-Wizard-Due-To-pod-install-Task-Failed#focus=Comments-27-5429773.0-0

retrieved from: https://kotlinlang.slack.com/archives/C3PQML5NU/p1660125428681559?thread_ts=1660052864.994119&cid=C3PQML5NU

alhamdulillah it solved our issues, when running kdoctor it has no error

mochadwi avatar Aug 26 '22 13:08 mochadwi