Cocoapods: 'File exists' error while 'pod install'.

Created on 1 Sep 2016  路  11Comments  路  Source: CocoaPods/CocoaPods

What did you do?

bundle exec pod install

What did you expect to happen?

Download dependencies and generate project properly

What happened instead?

An error 'File exists' occured.

Project that demonstrates the issue

https://github.com/Moya/Moya/tree/swift3

Command

/Users/eiolv/.rbenv/versions/2.3.1/bin/pod install

Stack

   CocoaPods : 1.1.0.beta.1
        Ruby : ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
    RubyGems : 2.5.1
        Host : Mac OS X 10.11.6 (15G31)
       Xcode : 7.3.1 (7D1014)
         Git : git version 2.7.4 (Apple Git-66)
Ruby lib dir : /Users/eiolv/.rbenv/versions/2.3.1/lib
Repositories : artsy - https://github.com/artsy/Specs.git @ a64d21ed844ef924553dc13fb18dcb82bd1f8b33
               master - https://github.com/CocoaPods/Specs.git @ 938c4f3ed0de87e3e14cfc8a08f77446e96b1a71

Plugins

cocoapods-deintegrate : 1.0.1
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.0.0
cocoapods-try         : 1.1.0

Podfile

source 'https://github.com/CocoaPods/Specs.git'

use_frameworks!

# Our Libraries
def libraries
  pod 'Moya', :path => "../"
#  pod 'Moya/ReactiveCocoa', :path => "../"
  pod 'Moya/RxSwift', :path => "../"
  pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire', :branch => 'swift3'
  pod 'RxSwift', :git => 'https://github.com/ReactiveX/RxSwift.git', :branch => 'swift-3.0'
  pod 'RxCocoa', :git => 'https://github.com/ReactiveX/RxSwift.git', :branch => 'swift-3.0'
#  pod 'ReactiveCocoa', :git => 'https://github.com/mhuusko5/Podspecs.git', :branch => 'swift3.0'
end

# Test Libraries
def test_pods
  pod 'Quick'
  pod 'Nimble'
  pod 'OHHTTPStubs'
end

target 'Demo' do
  platform :ios, '8.0'
  libraries
end

target 'MoyaTests-iOS' do
    platform :ios, '8.0'
    libraries
    test_pods
end

target 'MoyaTests-tvOS' do
    platform :tvos, '9.0'
    libraries
    test_pods
end

target 'MoyaTests-Mac' do
    platform :osx, '10.9'
    libraries
    test_pods
end

# Hack to fix testability until cocoapods gets an update
post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if config.name == 'Debug'
        config.build_settings['ENABLE_TESTABILITY'] = 'YES'
      end
    end
  end
end

Error

Errno::EEXIST - File exists @ dir_s_mkdir - /Users/eiolv/Development/Moya/Demo/Pods/Target Support Files/Alamofire-iOS8.0
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/cocoapods-1.1.0.beta.1/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb:92:in `mkdir'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/cocoapods-1.1.0.beta.1/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb:92:in `mkdir'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/cocoapods-1.1.0.beta.1/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb:92:in `create_support_files_dir'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/cocoapods-1.1.0.beta.1/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb:21:in `block in install!'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/cocoapods-1.1.0.beta.1/lib/cocoapods/user_interface.rb:142:in `message'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/cocoapods-1.1.0.beta.1/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb:19:in `install!'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/cocoapods-1.1.0.beta.1/lib/cocoapods/installer/xcode/pods_project_generator.rb:155:in `block (2 levels) in install_libraries'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/cocoapods-1.1.0.beta.1/lib/cocoapods/installer/xcode/pods_project_generator.rb:153:in `each'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/cocoapods-1.1.0.beta.1/lib/cocoapods/installer/xcode/pods_project_generator.rb:153:in `block in install_libraries'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/cocoapods-1.1.0.beta.1/lib/cocoapods/user_interface.rb:142:in `message'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/cocoapods-1.1.0.beta.1/lib/cocoapods/installer/xcode/pods_project_generator.rb:152:in `install_libraries'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/cocoapods-1.1.0.beta.1/lib/cocoapods/installer/xcode/pods_project_generator.rb:64:in `generate!'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/cocoapods-1.1.0.beta.1/lib/cocoapods/installer.rb:181:in `block in generate_pods_project'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/cocoapods-1.1.0.beta.1/lib/cocoapods/user_interface.rb:64:in `section'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/cocoapods-1.1.0.beta.1/lib/cocoapods/installer.rb:180:in `generate_pods_project'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/cocoapods-1.1.0.beta.1/lib/cocoapods/installer.rb:116:in `install!'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/cocoapods-1.1.0.beta.1/lib/cocoapods/command/install.rb:37:in `run'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/claide-1.0.0/lib/claide/command.rb:334:in `run'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/cocoapods-1.1.0.beta.1/lib/cocoapods/command.rb:50:in `run'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/cocoapods-1.1.0.beta.1/bin/pod:55:in `<top (required)>'
/Users/eiolv/.rbenv/versions/2.3.1/bin/pod:23:in `load'
/Users/eiolv/.rbenv/versions/2.3.1/bin/pod:23:in `<top (required)>'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `load'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `kernel_load'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:24:in `run'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli.rb:304:in `exec'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli.rb:11:in `start'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/exe/bundle:27:in `block in <top (required)>'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors'
/Users/eiolv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/exe/bundle:19:in `<top (required)>'
/Users/eiolv/.rbenv/versions/2.3.1/bin/bundle:23:in `load'
/Users/eiolv/.rbenv/versions/2.3.1/bin/bundle:23:in `<main>'

Most helpful comment

Same here.

One of my targets had "Use Legacy Swift Language Version" to unspecified. Once I change it to "No" it worked.

All 11 comments

Can you provide a link to a sample project? I believe this issue has already been fixed.

Woops. I see there's a link. I'll check it out.

@charlag just cloning that project on the Swift 3 branch and pod installing doesn't reproduce it for me. That said, this is probably a dup of #5700 and #5737. You can fix this by ensuring there is a Swift version set for each of your targets, which means making sure the legacy swift build setting is either set to Yes or No in the same way across the targets in your project: either individually in each target, or once at the project level for all of your targets. Those workarounds aside, the fix will be available in 1.1.0.beta.2, or you can try using CocoaPods master until the release is out.

Going to close, since this is likely the swift version handling issue that is fixed on master.

@benasher44 thank you! I already managed ti make it work. I think problem was that I tried to pod install first and set version afterward and tried to pod install again. When I cloned repo again and set Swift version first everything worked fine.

No problem! Glad you got it worked out!

Same here.

One of my targets had "Use Legacy Swift Language Version" to unspecified. Once I change it to "No" it worked.

@zirinisp Got the same problem. But I really want to use the legacy swift language version. What should I do?

go to Xcode and under the build setting set use legacy swift language version to no. Do the same on the projects that you are including and do not support it yet.

I had to fork some projects, fix them and submit pull requests.

How to fix this if set legacy swift language version yes?

@crossle ensure the all other targets defined in your Podfile always have it set to yes.

delete the generated pod folder, pod install again. solve my problem

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Mingmingmew picture Mingmingmew  路  3Comments

tlandsmancars picture tlandsmancars  路  3Comments

pallaviMN picture pallaviMN  路  3Comments

lzwjava picture lzwjava  路  3Comments

k06a picture k06a  路  3Comments