44
13: from /usr/local/bin/pod:23:in `<main>'
12: from /usr/local/bin/pod:23:in `load'
11: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0.beta.2/bin/pod:55:in `<top (required)>'
10: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0.beta.2/lib/cocoapods/command.rb:52:in `run'
9: from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:324:in `run'
8: from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:337:in `rescue in run'
7: from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:396:in `handle_exception'
6: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0.beta.2/lib/cocoapods/command.rb:66:in `report_error'
5: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0.beta.2/lib/cocoapods/user_interface/error_report.rb:30:in `report'
4: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0.beta.2/lib/cocoapods/user_interface/error_report.rb:105:in `markdown_podfile'
3: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0.beta.2/lib/cocoapods/config.rb:226:in `podfile_path'
2: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0.beta.2/lib/cocoapods/config.rb:166:in `installation_root'
1: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0.beta.2/lib/cocoapods/config.rb:166:in `unicode_normalize'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/unicode_normalize/normalize.rb:141:in `normalize': Unicode Normalization not appropriate for ASCII-8BIT (Encoding::CompatibilityError)

I am Facing these errors, don't know why when I run pod update it gives me this error. Any solution??

QED
  • 9,803
  • 7
  • 50
  • 87
MuhammadOmar
  • 518
  • 1
  • 4
  • 14

7 Answers7

122

This issues appeared in Cocoapods 1.11.0 and as many already noticed rolling back to 1.10.2 fixes the issue. But the original issue comes from wrong locale set in the terminal. It has to be a UTF-8-based locale.

You can run 'locale' in the terminal to check current locale settings. It should be something like this:

LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=

If you have ascii-based locales set or "C" (which is also an ascii locale) then run

export LC_ALL=en_US.UTF-8

If you prefer some other locale (not en_US) then run locale -a to see the list of available options and pick UTF-8 locale you prefer.

Actually CocoaPods warns that UTF-8 locale is required:

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

    export LANG=en_US.UTF-8

But before 1.11.0 it was required only in case you use pods which contain non-ascii symbols in their names (Chinese for example) but starting 1.11.0 it become more strict. There is a discussion on Cocoapods GitHub about it: https://github.com/CocoaPods/CocoaPods/issues/10939

Viacheslav Kormushkin
  • 1,323
  • 2
  • 7
  • 11
  • 6
    This should be the marked answer. Thank you – Pablo Johnson Oct 02 '21 at 11:23
  • Excellent answer. Indeed, this is better than CocoaPods's own guidance, quoted above, which only indicates that LANG is to be set. Only by setting all locale settings ala this answer was my problem solved. – QED Oct 07 '21 at 01:08
  • 2
    Unfortunately, it didn't help. "locale" command prints everything right, but I still get this error in Unity build with Google Dependency Resolver. Can't find what's wrong, so downgrading CocoaPods. – luvjungle Oct 18 '21 at 18:41
  • @luvjungle, I'd suggest verifying locale settings in the build environment itself by putting 'locale' invocation into the build pipeline, if you have not done this already. But it really may be something else in your case, I just described my investigation and solution that helped me. – Viacheslav Kormushkin Oct 19 '21 at 09:29
  • 1
    Same problem with IntelliJ + Flutter, I can't find out what shell/env it's using to run the build commands, but neither .profile, nor .zshrc, nor .bashrc, nor IntelliJ's own terminal env settings matter.... – Marian Theisen Dec 29 '21 at 10:27
  • 1
    @MarianTheisen I have the exact same problem. Only with IntelliJ + Flutter. Did you figure it out? – Rohan Taneja Aug 10 '22 at 00:35
  • This should be accept as correct answer, thanks @ViacheslavKormushkin for saving me, i have been trying to find solution for 2 days. – Ameer Hamza Dec 14 '22 at 10:24
93

The answer of Vyacheslav Kormushkin worked for me.

Concretely, what I did was:

  • open Terminal
  • type open ~/.zshrc (or .profile if you don't use zsh)
  • add export LC_ALL=en_US.UTF-8, and save the file
  • go back to Terminal
  • type source ~/.zshrc
  • type locale

==> The locale will now be fixed

==> You can now safely run pod update or pod install

dotdotcommadot
  • 1,371
  • 1
  • 9
  • 10
58

I fixed it doing this:

I uninstalled completely cocoapods (my version was 1.11.0)

gem list --local | grep cocoapods

cocoapods-core (1.11.0) cocoapods-deintegrate (1.0.5) cocoapods-downloader (1.5.0) cocoapods-plugins (1.0.0) cocoapods-search (1.0.1) cocoapods-trunk (1.6.0) cocoapods-try (1.2.0)

sudo gem uninstall cocoapods

sudo gem uninstall cocoapods-core

sudo gem uninstall cocoapods-deintegrate

sudo gem uninstall cocoapods-downloader

sudo gem uninstall cocoapods-plugins

sudo gem uninstall cocoapods-search

sudo gem uninstall cocoapods-trunk

sudo gem uninstall cocoapods-try

Then i installed cocoapods version 1.10.1 (you can try with more versions under 1.11.0 if you need)

sudo gem install cocoapods -v 1.10.1

Esteban López
  • 612
  • 6
  • 6
13

I had the same problem but using React Native, the following worked for me(direct):

LANG=en_US.UTF-8 pod install
Khurshid Ansari
  • 4,638
  • 2
  • 33
  • 52
danielm2402
  • 750
  • 4
  • 14
11

First solution is, to remove your current version of the cocoapods and rolling back to 1.10.2

To remove your current version, you could just run:

sudo gem uninstall cocoapods

then you can install the 1.10.2 version of cocoa pods via the following command:

sudo gem install cocoapods -v 1.10.2

The second solution is, to install the cocoapods via Homebrew with the following command:

brew install cocoapods
Sreeraj VR
  • 1,524
  • 19
  • 35
2

If you are here because of the failure outputs from Github actions. Try my solution:

add this to the top level of your github workflow yml file:

env:
  LANG: en_US.UTF-8

ref: https://docs.github.com/en/actions/learn-github-actions/environment-variables

johnny
  • 46
  • 5
0

if you have installed cocoapods using brew, run:

brew remove cocoapods

after that, install cocoapods using gem:

sudo gem install cocoapods -v 1.10.1