Raildex
Raildex

Reputation: 4765

Cocoa pods terminal utf-8 encoding

I am using IntelliJ AppCode for my project. When I try to use cocoadpods from AppCode's terminal, I get the following warning:

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

export LANG=en_US.UTF-8

I am using bash as my shell in AppCode (is zsh by default) and my Mac's terminal uses bash, too (was zsh).
I can execute pod commands just fine within the Mac's terminal.

I have also added the file .profile in my home dir and added the line

export LANG=en_US.UTF-8

and tried to close AppCode and even restarted my mac. but it doesnt seem to work.

Upvotes: 2

Views: 4702

Answers (3)

Pranav Sharma
Pranav Sharma

Reputation: 196

WORKING/TESTED on - July 2023 | CHIP - MAC M2 | MacOS - Ventura 13.4

What worked for me?

Step -1 : Uninstall Ruby using brew:

brew uninstall ruby --force

Step -2 : Uninstall all CocoaPods files. List all cocoapods version using following command

gem list --local | grep cocoapods

Start uninstalling all the versions of cocoapods from the list shown on the terminal one by one. In my case 8 different versions like following were listed

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

Step 3: Close the terminal {not just the window} totally.

Step 4: Start a new Terminal for the system to adapt to changes And now install cocoapods using following brew command.

brew install cocoapods

That's it... call "kdoctor" on the new terminal and everything should work cocoapods error should be removed.


If you still get any error then. ADDITIONAL CHECK call command

which ruby

If the resulting output is -

/usr/bin/ruby

Then call this command-

echo 'export PATH="/opt/homebrew/opt/ruby/bin:$PATH"' >> ~/.zshrc

Restart the terminal and check again, it should be resolved. Hope it helps...

Upvotes: 0

Dwipal Parmar
Dwipal Parmar

Reputation: 292

  • Open Terminal in android studio

  • Type open ~/.zshrc (or open ~/.profile if you don't use zsh)

  • It looks like that LANG="en_US.UTF-8" isn't enough, so you might have to set following as well, write follwoing code in the file and save it

      export LANG=en_US.UTF-8
      export LANGUAGE=en_US.UTF-8
      export LC_ALL=en_US.UTF-8
    
  • Open the again Terminal and type source ~/.zshrc and type locale

  • Now run pod install, this will works

Upvotes: 1

Patrick Piatkowski
Patrick Piatkowski

Reputation: 99

You can set the env vars mentioned by @saschpe in Preferences > Tools > Terminal in "Environment Variables". Works for me, also in Fish shell

AppCode Terminal Preferences

Upvotes: 2

Related Questions