Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jolasjoe opened this issue Oct 19, 2021 · 10 comments
Open

Comments

@jolasjoe
Copy link

jolasjoe commented Oct 19, 2021

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

@nilskasseckert
Copy link

nilskasseckert commented Dec 6, 2021

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

@krishnakumar4a4
Copy link

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:

@nilskasseckert
Copy link

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.

@AresProductions
Copy link

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
Copy link

AresProductions commented Feb 17, 2022

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

@nilskasseckert
Copy link

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.

@bio007
Copy link

bio007 commented Aug 11, 2022

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.

@RageshAntony
Copy link

  • 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants