5

I am trying to install a pod in project. But i am getting this error:

Invalid 'Podfile' file syntax error, unexpected $undefined, expecting '}'.

Podfile contains:

platform :ios, '7.0' pod 'RestKit', '0.21.0'

The terminal shows following message:

[!] Invalid `Podfile` file: compile error
/Users/work/Desktop/tg/RESTKitDemo/Podfile:1: syntax error, unexpected $undefined, expecting '}'
{\rtf1\ansi\ansicpg1252\cocoartf1265
^. Updating CocoaPods might fix the issue.

#  from /Users/work/Desktop/tg/RESTKitDemo/Podfile:1
#  -------------------------------------------
>  {\rtf1\ansi\ansicpg1252\cocoartf1265
#  {\fonttbl\f0\fmodern\fcharset0 Courier;}
#  -------------------------------------------

Can i know what is the problem with my podfile?

hasan
  • 23,815
  • 10
  • 63
  • 101
user2885928
  • 323
  • 1
  • 6
  • 13

5 Answers5

4

I got error

Invalid `Podfile` file: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('
pod 'MBProgressHUD'

becasue I was declaring Pod files like

pod 'SlideMenuControllerSwift',
pod 'MBProgressHUD'
pod 'SDWebImage'

there is one "," (colon mark) in above podfile name pod 'SlideMenuControllerSwift',. I just removed the colon mark. It worked.

correct way:

pod 'SlideMenuControllerSwift'
pod 'MBProgressHUD'
pod 'SDWebImage'
Anil Gupta
  • 1,155
  • 1
  • 19
  • 26
3

Assuming you correctly copied your Podfile over there needs to be a newline between those two lines.

platform :ios, '7.0'
pod 'RestKit', '0.21.0'

Also as of a relatively new version of CocoaPods you actually don't need that first line, the command line tool will determine the correct OS based off of your project's settings.

Edit:

From the new output you posted it looks like your Podfile isn't actually a plain text file. You should recreate it in an editor like Sublime Text and make sure it saves as a plain text file.

Keith Smiley
  • 61,481
  • 12
  • 97
  • 110
  • 1
    From the new output you posted it looks like your Podfile isn't actually a plain text file. You should recreate it in an editor like Sublime Text – Keith Smiley Oct 28 '13 at 05:12
  • @Keith, your mention about deleting the first line was very helpful today. Thanks a lot. – Marco Dec 19 '15 at 23:08
1

I was faced same problem when, I changed my MAC.

1- Make setup - Pod setup or update

So I created a new test project -- And open terminal Run these command

cd /path your project
pod init
// add any pod in your pod file 
pod install

and then you can update pod in your old project .

Abhishek Mishra
  • 1,625
  • 16
  • 32
0

No special characters or any thing else is allowed in pod file, except the name of pod which we are integrating, unknowingly if we enter any characters such as , \ etc. it may result in the following error.

0

I just ran into this issue because I was doing:

pod 'Fireworks', :path '/Users/honey/Documents/mypod-ios'

The fix was to just add: =>

pod 'Fireworks', :path => '/Users/honey/Documents/mypod-ios'
mfaani
  • 33,269
  • 19
  • 164
  • 293