Apple Mach-O Linker & Ditto Error - Xcode 8
Solution 1
- Quit Xcode
- Restart the System
- Select Xcode -> Preferences.
This will open a pop-up window. Select 'Locations'. In Locations, you will see 'Derived Data'. Click on the arrow icon right next to the path.
This will open a folder containing 'Derived Data', delete it. - Clean the Product and Run
Solution 2
Make sure you open the project from the .xcworkspace
file instead of the .xcodeproj
Solution 3
step 1 = clicking on the project in the navigation menu
step 2 = select the project
step 3 = build settings
step 4 = search enable bitcode if bitcode is yes than change to No
Solution 4
None of the previous answer have solve my problem. I think it come from changes in the cocoapods podFile, from using frameworks to not using them
Frameworks was still remind in Target>General Properties>Linked Frameworks. I removed them I also remove the -framework and corresponding frameworks from other linker flags (saving inherited and objC flags)
Hope that could help
Solution 5
This happened to me after I delete my app while it was running.
I solved it cleaning the project.
Product > Clean or Shift + Command + K
Related videos on Youtube
![LinusGeffarth](https://i.stack.imgur.com/t9AGX.jpg?s=256&g=1)
LinusGeffarth
I'm co-founder & CTO at Funeral Marketplace, a B2B2C online marketplace connecting every player in the funeral industry. I'm also head of software development at CONVELA and have my own little development studio for side projects: ögli{codes}. I've started out as project manager building a little app with my uncle; then began developing for iOS my own (for iPad using Obj-C at the time); made some iPhone and iPad apps (Swift). Eventually we founded the Funeral Marketplace, for which I led the iOS development (Swift) and managed the web (react.js) & backend (php, laravel) development. I then began developing for the frontend and backend as well, while also building my knowledge in server-side swift using the Vapor framework making me full-stack. #SOreadytohelp Stack Overflow to me, means endless possibilities. I feel like I can do anything using all the never-ending source of knowledge people share on SO. I am #SOreadytohelp because I want to give back exactly what I got and much more. I want to share my knowledge as much as possible to help people around the world progress and create beautiful things. I want to thank Stack Overflow for teaching me to code & helping me out every day. ♡
Updated on July 09, 2022Comments
-
LinusGeffarth almost 2 years
I have just updated my Xcode to Xcode 8 and am now trying to convert my project's code to Swift 2.3. I was able to build a couple times using Xcode 8 without any errors. Now, the following errors came up:
Error #1: Apple Mach-O Linker Error: Linker command failed with exit code 1
ld: file not found: /Users/Linus/Library/Developer/Xcode/DerivedData/MyApp-asdjeshhsetnfxbegcsbcipdreneewgr/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64/DownloadsViewController.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)I don't even know what a
.o
file is. The swift file ofDownloadsViewController
is there, though.Error #2: Ditto Error: Command /usr/cin/ditto failed with exit code 1
ditto: can't get real path for source '/Users/Linus/Library/Developer/Xcode/DerivedData/MyApp-asdjeshhsetnfxbbciegrfdpdreneewgr/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64/MyApp-Swift.h'
Command /usr/bin/ditto failed with exit code 1The ditto error occurs 3 times: for
MyApp.swiftdoc
,MyApp.swiftmodule
, andMyApp-Swift.h
.Thanks in advance!
-
Bhavin Bhadani almost 8 yearsin project navigator , search for DownloadsViewController file .. I think there is duplicate file with same name .. check it once
-
LinusGeffarth almost 8 yearsNope, no duplicate file.
-
-
LinusGeffarth almost 8 years"Have you tried turning it off and on again?" - Thanks for the effort, didn't help though.
-
RakeshDipuna almost 8 yearsHave you tried those procedures what I have mentioned above ?
-
RakeshDipuna almost 8 yearsIf you have the project back up ,then delete DownloadsViewController file and then do copy from the back up to your target
-
RakeshDipuna almost 8 yearsHave you copied ?
-
LinusGeffarth almost 8 yearsNo I mean I have followed your steps. What do you mean by "copy from the back up"?
-
RakeshDipuna almost 8 yearsOky let me explain ! your project might not get your DownloadsViewController file path during linking time after upgrading to Xcode8 .So better delete the that file and add it again from your back up .
-
LinusGeffarth almost 8 yearsOk but wouldn't that mean I couldn't even open the file in Xcode?
-
RakeshDipuna almost 8 yearsstackoverflow.com/questions/15189913/…. Delete your file and and add how it is being added using this link .clean the project and run .Oh ..your xcode fixes the error itself .sorry then
-
EFE about 7 yearsi just select product->clean and run error gone xcode 8 macos 10.11
-
Miroslav Hrivik about 7 yearsWhile ago I had changed name of my app target to new app name. I had to change it also in pod file. But the old pods framework was still listed in linked frameworks and libraries. After I removed it, build started to work.
-
TheBrockEllis about 7 yearsI had added a Cordova plugin that required me to install CocoPods. It looks like if you open the
.xcodeproj
file it doesn't pull in those dependencies. If you open up the.xcworkspace
file, it does and is able to build successfully. Thanks for the tip @Agu Dondo! -
Sooraj about 7 yearsWhere is this located?
-
Graeme Rock about 7 yearsHow do I create a .xcworkspace from a .xcodeproj then?
-
asimolmez about 7 years@SoorajChandran You can see in Project Navigator.
-
Romain TAILLANDIER almost 7 years@Graeme Rock. In this particular case, you have to make a 'pod install'. please refer to CocoaPods community. it is a dependency manager from the community, that should have been part of Xcode ...
-
regina_fallangi almost 7 yearsthis did it for me
-
Babken Vardanyan about 6 yearsThis was the answer for me. I added the file using AppCode.