52

I added new pod in PodFile and ran command

pod install

It deleted all previous pods and failed with following error

Unable to find a target named `ProjectName`

However I recovered all deleted pods by using Git, but now my project is not being compiled, it's giving me the following error:

/Users/userName/Library/Developer/Xcode/DerivedData/Project_Name-fhktwvetozjdorboqdzfwlpzrcyw/Build/Intermediates/Project_Name.build/Debug-iphonesimulator/Project_Name.build/Script-D7BB987C75C5AEC6033AA28E.sh:
/Users/userName/Desktop/iOS_Workspace/Project_Name/Pods/Target Support
Files/Pods-Project_Name/Pods-Project_Name-resources.sh: /bin/sh^M: bad
interpreter: No such file or directory

I tried every solution regarding pods, but neither worked for me.
Any help will be appreciated. Thanks

2
  • What does your podfile look like?
    – fsb
    Apr 1, 2016 at 22:10
  • its like executable file, not like normal text file, I don't know why.
    – Aamir
    Apr 2, 2016 at 5:46

9 Answers 9

166

After spending hours on Google just opened Podfile and found that project name is wrong. So I have just written correct project name in Podfile and issue has been resolved.

Before:

target 'Wrong Project Name' do
    pod 'Parse'
    pod 'SDWebImage'
end

After:

target 'Correct Project Name' do
    pod 'Parse'
    pod 'SDWebImage'
end
5
  • 4
    This happened to me after renaming a project, I failed to update this line in the podfile. This answer saved me a lot of time, thanks!
    – Schuuure
    Oct 15, 2016 at 17:43
  • 2
    This happened to me after removing the Test target from XCode, this solution worked for me, thanks!
    – cesarmart
    Apr 24, 2020 at 20:29
  • thanks for the solution...
    – Madhu
    Dec 15, 2021 at 5:16
  • Oh man thank you so much
    – snake302
    Feb 10, 2022 at 9:29
  • 1
    You laid down hours of your life so that I wouldn't have to, for that I thank you.
    – meds
    Jun 17, 2022 at 14:35
13

According to the error, you specify a target named ProjectName but this does not exist in your project. Read the podfile syntax reference carefully and make sure you add the right target name (in my case it's called Tester:)

enter image description here

3
  • 2
    I just replaced my project name with "ProjectName", to hide my project name.
    – Aamir
    Apr 3, 2016 at 13:56
  • Ok, but are you sure you are using the correct target name? Or maybe you run pod install while at the wrong path? Also, try to google /bin/sh^M: bad interpreter: since that ^M looks weird
    – phi
    Apr 3, 2016 at 15:47
  • This is WORKED FOR ME
    – GUGAN RAJ
    Nov 29, 2021 at 15:03
4

It is due to target name changed.

just opened Podfile and replace target name with new target name.

(In my case “GoogleMapSample” was “Map Sample”,

“GoogleMapSampleTests” was “Map SampleTests”,

“GoogleMapSampleUITests” was “Map SampleUITests”,

means I just replace “Map Sample” with “GoogleMapSample” for all targets)

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'GoogleMapSample' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

    pod 'GoogleMaps'
    pod 'GooglePlaces'
    pod 'Alamofire', '~> 4.4’
    pod 'SwiftyJSON', '~> 4.0'


  # Pods for GoogleMapSample

  target 'GoogleMapSampleTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'GoogleMapSampleUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end
2
  1. Take backup of podfile (copy paste at specified location).
  2. Remove pod file. Move to Trash (from) Xcode.
  3. Go to terminal, After locating your pods directory, Hit: pod init
  4. Paste contents from backup-ed file (1st step)...Copy only pod libs. ex. pod 'Firebase/Core'
  5. pod install
  6. Re-start your project then open YourProjectName.xcworkspace.
1

In my case, the target name was the same,
but it was case sensitive wrong.
"myTarget" // podfile
"MyTarget" // Xcode

1
  • Mine have been copied and posted and are 100% correct, still getting error.. the error even says couldn't find 'A', found 'A' ...?
    – JCutting8
    Oct 18, 2022 at 12:38
1

make sure your current name for project in Podfile Matching with right name

target 'Project name' do
  use_frameworks!

  # Pods for Project name

pod 'SwiftMessages'

end
0

I have a lot of schemas like below. So, we should map a schema in pod file.

Wrong : target 'MobileBranch' do

Correct : target 'Test-MobileBranch' do

Correct : target 'Main-MobileBranch' do

enter image description here

0

If you are here in 2022 using SwiftUI, I just uncomment the line and specified the latest iOS version. I am using Xcode 14.0.1.

# Uncomment the next line to define a global platform for your project
platform :ios, '16.0'
0

FIXED

Just I changed App to the correct name of the product which is Mevenda:

target 'Mevenda' do
  capacitor_pods
  # Add your Pods here
  pod 'FirebaseStorage'
end

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.