20

When I type

pods install

or

pods update

I get the following error for one library:

Unable to read the license file /Users/me/Documents/project/myproject/company/myproduct/Pods/OHAttributedLabel/OHAttributedLabel/LICENSE for the spec OHAttributedLabel (3.5.3)

Does anyone know why? I have been suggested:

pod repo remove master
pod setup

to no avail

pkamb
  • 33,281
  • 23
  • 160
  • 191
user1709076
  • 2,538
  • 9
  • 38
  • 59

10 Answers10

27

In my case this was related to someone in my team committing their .xcworkspace file to the repository, which meant running pod install gave me the licence warnings but at the same time, did not install my pods properly.

This is how I resolved it:

  1. First close Xcode.
  2. List item
  3. Delete the Pods folder from your project
  4. Delete the .xcworkspace file,
  5. Delete the Podfile.lock file
  6. And then finally, for good measure delete the DerivedData folder

Now run pod install and the issue should be fixed.

Michael Gaylord
  • 7,282
  • 8
  • 50
  • 47
8

My problem was that when I initially added the tag to git, the LICENSE file was not there. I fixed this by:

  1. Remove the tag from the git repo
  2. Make sure the LICENSE file has been committed to the git repo
  3. Add the tag to the git repo again
  4. run pod cache clean --all
  5. run pod spec lint again

It should now work.

Perlguy
  • 982
  • 10
  • 25
  • 2
    `pod cache clean --all` solved for me even mush bigger problem (lint was not passing validation, now passes), but license file is still unable to be read... – Nikita Feb 08 '19 at 15:42
  • eventually it was a typo... :) – Nikita Feb 08 '19 at 16:09
  • @Nikita Have you find a way for the `Unable to read the license file LICENSE for the spec` now? – Lynx Dec 09 '19 at 09:42
7

I just had this issue today, seems to have been caused by my cache being corrupted somehow; perhaps a charset issue? No idea, but the solution that worked for me was the bash script in this Gist.

It clears the cocoapods cache so that you get a fresh copy of all required when you next run pod install. Fixed my problem immediately, confirming my suspicion, and hasn't reoccurred since.

MattMatt
  • 2,242
  • 33
  • 30
  • i was having the same error message and it was a real problem b/c i could no longer compile. MattMatt's solution solved the problem for me. (note: changing ruby versions as i've seen suggested above and elsewhere did not solve the problem for me). i'm running OS X El Capitan (10.12.2). – dave adelson Feb 03 '16 at 12:12
7

run

pod deintegrate

then

pod cache clean --all

and

pod install

pod deintegrate

andreskwan
  • 1,152
  • 1
  • 13
  • 13
7

I get this frequently. This works for me.

  1. pod deintegrate
  2. pod setup
  3. pod install

From terminal I run these commands altogether like below

pod deintegrate && pod setup && pod install
Saurabh Bajaj
  • 473
  • 4
  • 7
2

TL;DR It's Ruby 2.2.+ in OS X. Go back to Ruby 2.1.6.

This was my problem.

[!] Unable to read the license file '.../LICENSE_.txt' for the spec 'pod (v.v.v)'

But also had the problem in Rails.

I had the same problem last week. And Rails had the same problem with load paths with Capital letters in the file path.

This is the question and their response. Strange error in rails - missing helper

This is the issue on Github https://github.com/rails/rails/issues/18660

So, i thought there is the same problem. I go back and the cocoa pod CLI copied all the Licenses in acknowledges.

In fact, we should post an issue on cocoa pods github.

Community
  • 1
  • 1
gzfrancisco
  • 812
  • 10
  • 14
2

In my case, the pods which complained about the LICENSE file didn't actually have a LICENSE file in their folders. My steps to fix this:

  1. Went to [project_name] -> Pods
  2. Opened a pod which already had a LICENSE file. Copied that file and pasted it inside the pod folder which is complaining.
  3. Found the complaining pod on cocoapods.org
  4. On the bottom of the page, there is written who owns the copyright (MIT, Apache, etc.)
  5. Click on the link that's in the License part, and you will be redirected to the page where you will find an example of a copyright statement. Copy and replace the old copyright from the file you have in the folder now.
  6. In the [year] field check the latest when the pod was updated.
  7. In the [copyright owner] use what's written on the pods page under Author.
  8. Save the file.
  9. run pod install in the terminal.

Use this image for reference. enter image description here

Starsky
  • 1,829
  • 18
  • 25
  • The issue for me was: License email and name did mismatch the author mail and name. Once those were the same, the issue disappeared for me. – dvp.petrov Dec 06 '19 at 08:04
2

This is what worked for me:

  1. remove the offending pod from Podfile
  2. pod install
  3. pod cache clean --all
  4. add pod back into Podfile
  5. pod install

Note: Be sure to pin the version from Podfile.lock in the Podfile if the locked version is required

0

If I copy the old pod.lock from an old git branch over the latest git branch I no longer see 'pods is out of sync', and I don't have to redo 'pod update' 'pod install' again.

Someone in the team updated pods, and therefore the pods.lock file changed version the scribbly alphanumeric characters next to the libraries we use.

What's up with that though? Seriously if we update our libraries and then change to a different branch we'll need to update pods and rebuild - Is this the way the process is intended to be for pods and git?

user1709076
  • 2,538
  • 9
  • 38
  • 59
0

In my case, I solved this issue by changing the name of my license file from LICENSE to LICENSE.txt, updating the file name in the podspec, and including both the framework and the LICENSE.txt file in the zip file for my repository.

ScottyB
  • 2,167
  • 1
  • 30
  • 46