'iOS - CocoaPods requires your terminal to be using UTF-8 encoding - after latest flutter upgrade
I am getting this error after I upgraded flutter. Before upgrading everything was working normal on both iOS and android. Now my project is not building in iOS.
Below is my terminal info.
pod setup --verbose
WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
Consider adding the following to ~/.profile:
export LANG=en_US.UTF-8
pod install --verbose
WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
Consider adding the following to ~/.profile:
export LANG=en_US.UTF-8
[!] No `Podfile' found in the project directory.
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:151:in `verify_podfile_exists!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/command/install.rb:46:in `run'
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:22:in `load'
/usr/local/bin/pod:22:in `<main>'
locale
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
Solution 1:[1]
finally i have solved this with below steps
- export LANG=en_US.UTF-8
- opened project in Xcode and cleaned it.
- opened iOS folder in mac terminal and ran pod install
- it gave me warming of using ios 9.0 so i updated it to 10.0
- ran
flutter build ios
- project build successfully
- opened Runner.xcworkspace in xode
- clicked on run - this time Xcode again installed pod automatically
and Solved.
Solution 2:[2]
open Terminal type open ~/.zshrc (or .profile if you don't use zsh)
It seems that LANG="en_US.UTF-8"
alone isn't enough, you have to set
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
save the file
go back to Terminal
type source ~/.zshrc
type locale
You can now safely run pod update or pod install
Solution 3:[3]
After one day of struggle finally i found the full solution
Follow these steps to solve this issue
- Unhide filles in Mac using
Cmd + Shift + dot
. - Go to Macintosh HD -> User -> (Your user ).
- Search for
.zshrc
- Open it with any editor (I recommend VS code)
- Under.
#User configuration
comment outexport LANG=en_US.UTF-8
. - Open your flutter project and manually delete Pods folder, Podfile, Podfile.lock. (back-up all podfiles)
- Restart your Mac and run your flutter application
- Run
pod install
- It will automatically create podfile and its new config in UTF - 8 encoding
- Enjoy and chill i got your back !!!!!
Solution 4:[4]
- Clean files with
flutter clean
- Type
vim .zshrc
in your terminal. This should open up your.zshrc
profile. TypeI
to insert something. Then, simply paste in exportLANG=en_US.UTF-8
and hit ESC to get out and then type:wq
to save and quit. - Opened project folder, next open iOS folder in mac terminal and run
pod install
- It may give warning of using ios 9.0 so update it to 10.0, for that open Podfile in text edit and uncomment or change
# platform :ios, '9.0' to
platform :ios, '10.0' - Run
flutter build iOS
in the main root project through the terminal. - Run main root file eg.
flutter run
If you are facing a problem with Flutter. Try this solution
- Delete the Podfile, Podfile.lock, Pods folder, Runner.xcworkspace
flutter clean
flutter build ios
Solution 5:[5]
To iterate on Shruti Tupkari's answer ~ To add in export LANG=en_US.UTF-8
to your terminal it needs to be added to a profile such as .zshrc
, .bashrc
, or .bash_profile
.
To do this simply use vim
So try
vim .zshrc
This should open up your .zshrc
profile. Type 'i' to insert something.
Then simply paste in export LANG=en_US.UTF-8
hit esc to get out and then type :wq
to save and quit
Try and run your app again. If you get the error, repeat the same steps on the other profiles in your computer.
Here's some information on how to use vim
Solution 6:[6]
If adding export LANG=en_US.UTF-8
doesn't help, try export LC_ALL="en_US.UTF-8"
Credits: https://github.com/CocoaPods/CocoaPods/issues/6333#issuecomment-551052399
Solution 7:[7]
The proper solution, without re-installing anything, can be found:
- here: https://stackoverflow.com/a/69160445/3821002
- and here: https://stackoverflow.com/a/69376499/3821002
The crux is to use export LC_ALL=en_US.UTF-8
.
The links above explain how to do that.
Solution 8:[8]
To fix this, you might want to find either your ~/.bash_profile (for bash) or ~/.zshrc (for zsh) and add the export line that you put in your ~/.profile export LANG=en_US.UTF-8
That was all I had to do.
Solution 9:[9]
In my case the following needed to be added to .bash_profile
instead of the other suggested files.
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
Solution 10:[10]
After upgrading mac os big sur version I get this error when I try to build ios unity.
If you don't have the file .profile, you can create new file .profile in /Users/"user-name"/.profile
step 1: open terminal. create new file .profile
$ cd
$ touch .profile
step 2: edit .profile.add
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
in .profile
Solution 11:[11]
I had this problem only in android studio. When I switched to the terminal outside Android Studio it worked fine.
Solution 12:[12]
Just open your terminal and enter the below command
export LC_ALL=en_US.UTF-8
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow