4

I am trying to setup terminal/Xcode to work correctly for the Xcode CocoaPods Plugin.

When I run integrate cocoapods option from the plugin I get a message:

[33mWARNING: CocoaPods requires your terminal to be using UTF-8 encoding. See https://github.com/CocoaPods/guides.cocoapods.org/issues/26 for possible solutions.[0m

I have searched for the answer to this but I cannot find it. The resolution appears to be to complete the following:

export LC_ALL="en_US.UTF-8"

I am not sure how to complete this? I have run this in terminal and then when I output the locale I see the following:

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

However, when I quit/reopen Terminal the LC_ALL is blank again. Is there something I should run after this?

EDIT - I have seen this link http://perlgeek.de/en/article/set-up-a-clean-utf8-environment but still unable to complete the install of the locale, not sure how.

0xced
  • 25,219
  • 10
  • 103
  • 255
StuartM
  • 6,743
  • 18
  • 84
  • 160

3 Answers3

7

So there's two ways to approach this, which is reflected in the two types of answers here.

One is to make a permanent change to your environment by changing your shell configuration (e.g. .bashrc or locale defaults). So running this app on another machine will run into similar errors.

The other way is to change this setting as part of the build process of your app, so it will run successfully on any machine - but every time you create a new app using the Cocoapods plugin you'll need to add this script.

My preference is for the latter, so here's how to do that:

Edit your current build scheme - cmd-option-R

Expand Build, and select Pre-actions

Add a New Run Script Action

Then for your script, just add:

export LC_ALL="en_US.UTF-8"

This worked for me. It should look something like this:

enter image description here

Taylan Aydinli
  • 4,333
  • 15
  • 39
  • 33
weissazool
  • 185
  • 7
0

Are you typing this manually or running it in a shell .rc file?

Depending how CocoaPods is running will indicate where to put these defines in the proper shell startup file to make sure they occur on each shell session.

If you don't own a copy of O'Reilly's Unix in a Nutshell, I strongly recommend it.

I put a series of aliases and defines in my .bashrc and .bash_login which makes sure that terminal based and non-terminal based bash sessions pick up additional defines and aliases.

For information on bash dot files you can look at StackOverflow's discussion of this. As there is a very good answer on it.

In general you can simply put the commands into these files. A standard test to see how the encompassing app (Pods in this case) may be calling into the shell is to simply put commands into each file like:

echo "running .bashrc"

Be careful of line endings (I always add extra returns at the end) and spacing. Shell is a very different beast from Objective-C

Community
  • 1
  • 1
Dru Freeman
  • 1,766
  • 3
  • 19
  • 41
  • I am running these manually. I think you are right that I need to actually run these specifically in my .bashrc, can you confirm how I can do this please? – StuartM Dec 02 '13 at 15:48
  • Thanks - I am not sure I understand the steps to complete here? running your suggested echo just shows the text, is that not expected? I am running pod install command but from an Xcode plugin as mentioned in the question, I think it is due to the LC_ALL not being set, but unsure how to set it so that the setting stays set? – StuartM Dec 05 '13 at 17:30
  • The echos in the files help you determine which are being called by the Xcode plugin. Then you know which file to place your commands into as above. – Dru Freeman Dec 07 '13 at 00:53
  • I am sorry I am still none the wiser, where are the actual echos going into what specific file? – StuartM Dec 08 '13 at 21:18
0

Hit cmd-option-R and do something similar to what is in the screenshot:

enter image description here

maz
  • 8,056
  • 4
  • 26
  • 25
  • 1
    This did not work. Running the pods in Xcode still returns the same message as mentioned in question. – StuartM Dec 05 '13 at 17:33
  • add a build stage `Execute shell`. Make sure it runs before you call cocoapods. In there put: #!/bin/bash source ~/.bashrc – maz Dec 05 '13 at 20:37
  • to confirm, this happens when using the 'integrate pods' option from the Xcode plugin. Which in turn is running a 'pod install' command from Xcode, nothing to do with the build of the application. – StuartM Dec 06 '13 at 09:56