How to clean junk files in Xcode from iOS support - xcode

I have tried cleaning the simulator but it again occupies 6gb disk space on my Mac.
Can anyone suggest manual cleaning?

If the objective is to free up disk space occupied by Xcode-related and simulator-related caches and data, and not just iOS support files, there are other folders you can look into to consider removing files, besides ~/Library/Developer/Xcode/iOS DeviceSupport/ and ~/Library/Developer/Xcode/DerivedData that have been mentioned in the other 2 answers so far.
~/Library/Developer/Xcode/Archives/ contains data from your builds that can be helpful in the process of symbolicating/debugging deployed apps, but could otherwise be removed. Thankfully, it is organized by date, so you can choose to keep specific folders inside it, and delete the rest
~/Library/Developer/CoreSimulator/ contains simulator related data. It includes a Caches folder and a Devices folder. If you no longer need to run your apps on certain devices, you may consider removing those devices' corresponding folders in the Devices folder. The Caches folder may grow over time as well, and you can remove contents from there, and they should be regenerated as needed.
If you've been using this machine for some years, it may be worth looking for ~/Library/Application Support/iPhone Simulator. The simulator related files used to be there until around Xcode 6. So you may have files still there that you might want to delete (I did, on some older Macs some years back)
There's an Xcode specific cache (not about simulators), ~/Library/Caches/com.apple.dt.Xcode, which should be regenerated as needed, but may be less useful to clean up.
You could also consider running DevCleaner from time to time to remove unnecessary Xcode-related files.

Delete the contents of "~/Library/Developer/Xcode/iOS DeviceSupport/".
Remove all "paired devices" in iOS settings > Developer.
Connect iPhone to the Mac and pick "Don't trust".
Since the above is not okay for iTunes syncing etc, try the following:
Delete the contents of the folder "~/Library/Developer/Xcode/iOS DeviceSupport/" and then right click > get info > lock the folder.
Locking the folder will stop Xcode from copying the simulator files from the iPhone to that folder next time you connect them.
https://apple.stackexchange.com/questions/380024/how-to-stop-xcode-downloading-ios-support-package-of-my-iphone
It is possible that Xcode starts downloading it via nsurlsessiod so you can block it either
by using a firewall
https://apple.stackexchange.com/questions/393689/how-to-stop-catalina-from-contacting-apple-servers-when-executing-programs/393698#393698
Or by renaming the binary as explained at the link below. (I haven't tried it)
Xcode simulator constantly download something

Command-Option-Shift-K to clean out the build folder. Even better, quit Xcode and clean out ~/Library/Developer/Xcode/DerivedData manually. Remove all its contents because there's a bug where Xcode will run an old version of your project that's in there somewhere
By following this steps you can do....

For user who are not able to find library/developer path.
open Xcode( i am using Xcode 13) -> file -> workspace setting -> there will be a path at center of modal -> click on arrow button next to path -> on clicking it will open up the folder.

Related

How to trash app file with pathname too long after failed app build - Xcode 12 new build system with MacOS 11.5.2

I have files in trash that I can't delete with an error that the pathname is too long. How can I get rid of those?
Where these files came from: I was getting Xcode 12 build failures after switching over to new build system with a plist too long error; stackoverflow helped with that -- the problem was that somehow the Product target (the app) was marked as included in the target, thereby recursively creating a giant path for the app. So unchecking the box allowed the build to complete. Thanks everybody!!
However, in the fray, I frequently cleaned the Build folder or trashed the Derived Data folder. Now I have a bunch of zero-length files for the app in the trash; emptying the trash fails with an error that it can't delete the app file because the pathname is too long. Nothing else got deleted from Trash either.
Any suggestions of how to get these cleaned up?
I managed to clean up the bad app files, but I have no idea why it worked. Note that the app icons were greyed out with a "stop" icon throughout. I decided I would clean up as much as possible, so I dragged all of the current contents of Trash (the many Derived Data & Build folders) into another desktop folder, and moved everything that wasn't a bad app file back into Trash, and emptied Trash. I left each app file in its immediate enclosing folders. Then I tried to consolidate the remaining bad app files into as few folders as possible, and along the way I discovered that I could force a replacement of one bad app file with another (just dragging it into the other's folder). So I got down to only one bad file. Then I tried moving it Trash, and bang - I could empty Trash now! Maybe my manipulations caused it to get a legal size path? Most bizarre thing I have seen on MacOS, and I started with the original 512K Mac! Any explanation?

Xcode Source Editor option not displayed in Extensions

Is there a way to activate Xcode Source Editor option in System Preferences > Extensions? For some reason, it's not showing on my Mac (the last option).
If the Xcode Source Editor is missing from the left pane (see image above), try one of these solutions before resorting to a reinstallation:
In the Applications folder, rename Xcode and then change the name back to Xcode, or move Xcode.app out of the Applications folder, then back in, as described by this Stack Overflow answer.
Move the Xcode app to the Trash and re-install it from the AppStore.
I install the Xcode manually that's why not found on Extensions.
To fix quickly:
Quit Xcode
Rename Xcode in the applications folder temporarily with any name.
Launch renamed Xcode
Quit Xcode
Name it back to the old value ("Xcode")
Go back to Extention you will find the Xcode
The entry is shown if the system detects that both Xcode and at least one Xcode extension is installed. Yet the code to detect Xcode has a few issues.
If you install Xcode first and don't have an extension, the entry is not shown. If you then install an extension, the system re-checks if Xcode is still installed and if yes, it should add the entry. However, the check code will fail in some situations. E.g. if you renamed Xcode.app to something like Xcode_13.4.app (as you need to manage different versions of Xcode), the detection code may not find it. It also may not find it if you moved Xcode to a different location outside of /Applications. And even if not renamed and still in the default location, the detection code sometimes fails and the exact reason why that happens is unknown (it may have issues with certain ownership, certain file permissions, case-sensitive file systems, etc.)
In all these situations, renaming Xcode causes it to be re-detected by the system and then the system sees that Xcode and at least an extension is installed and the entry appears immediately. No need to reboot or start the renamed Xcode; you rename it, you rename it back, and the entry is there and will stay there (even after deleting all extensions, it stayed on my system).
If you first installed any app with an extension and then Xcode, the problem does never appear as in that case you immediately trigger the rename-fix above, because the moment you install Xcode, the system will always detect it correctly (regardless how the app is named or where it is located or any other issue the scan code might have) and detecting Xcode and knowing there is an extension, the menu entry appears at once. The code that detects Xcode extensions seems to always work correctly.
This is probably one of the issues where the Xcode detection code has not been tested very well by the Apple but since it seems to work for the vast majority of users, Apple sees no reason to further investigate why it would sometimes fail.
It will get activated by default if any plugin are added in Xcode.
You have to download XcodeClangFormat plugin from GitHub and follow the installation steps. Then Xcode Source Editor will be visible automatically.
Please refer this link

Images files still appearing in app even after deleting every supporting files Xcode 6.4

I deleted all my supporting files form Xcode's project and still when I run the app some how some images are still there/appearing but when i search in the search box for the file at the bottom left of the project. It says that there no file of that name in my project does anyone know why or how this is happening? And theres nothing in assets I'm using Swift if it helps Thanks
Old things that you delete from the project are not deleted from the built app, or from the intermediates along the way. To do that, you need to clean all the caches, and also clean out any old built versions (e.g. clean the simulator, and also delete from the device if you've been testing on a device).

How do I remove the default localizations from a Phonegap/Cordova project?

I've just had a Phonegap/Cordova iPhone app approved for the app store but noticed it claims to be available in a bunch of other languages including Northern Sami. I've found the list of languages in xcode under localizations and tried deleting them but if I restart xcode they re-appear.
I've also tried deleting lproj folders in the resources folders but that doesn't help either.
I'm at a loss to what to do next so any help would be much appreciated.
Here is a step by step guide of how I do it. (Order matters)
First go to the Resources folder in the Phonegap project. Within this folder there are several folders ending in *.lproj. Delete all of them except for en.lproj (Assuming your language is english).
Even though you deleted those files from your hard drive they're still linked in Xcode. Open up your *.xcodeproj and delete all of the folders from the side bar once again.
Normally this should suffice, but if you're still having problems go to the app's project tab (rather than target) and under info you can find and remove all the current localisations.
Oh and btw if this still isn't enough you can look at the details of your app's binary in iTunesConnect to verify if it worked before releasing the app.

Xcode- Deleted images appear in simulator

Mac OS X Lion v10.7.2
Xcode v4.2.1 Build 4D502
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Thu Nov 3 21:59:02 UTC 2011)
I have a bunch of images in my resource folder, but when I delete those images and run in simulator again, the images are still there. I have completely deleted the images from the Project Editor window (not from Finder), and I used DELETE (not Remove Reference Only), and they are still showing up in the simulator. If I add new images back in (with the same names) thru the Project Editor window (not from Finder) the old ones are still being used as well instead of the new ones.
I have tried:
1) Deleting images from Project Editor window.
2) Delete app from simulator (click and hold, then delete while wobbling), then restart computer.
3) Choosing Product > Clean.
4) Choosing Product > Option+Clean.
5) Choosing Show Package Contents of .xcodeproj file, and deleting everything in the xcuserdata folder.
This is an incredibly annoying bug!
How do I tell Xcode to stop using cached images?
I am newbie, so something like "Clean Targets" does not mean anything to me, unless you give me the instructions on how to do it as well.
Thanks
EDIT:
Here is another option we all missed, which might do the same thing as deleting the /Simulator/../Applications folder:
In the iOS Simulator menu, there is an option called Reset Content and Settings ...
it never occured to me that the simulator was a separate app from Xcode, so I never thought to check menu items while simulator had focus!
Manually removing the build folder may help. Clean does not always do this properly, for reasons unknown. The build folder used to be in the project directory, but now (also) exists in ~/Library/Developer/Xcode/DerivedData/
Solved by original poster:
Oh wait I had a brainstorm because of your suggestion above, and from
Terminal I used: find . -name 'myimage.png' 2> /dev/null and I found
the secret hidden cache! It is in my user library here:
~/Library/Application Support/iPhone Simulator/4.3.2/Applications/
Just delete everything in the Applications directory. May also need to
do this one as well: ~/Library/Application Support/iPhone
Simulator/5.0/Applications/
I had the same thing when I was adding transparent background to an image that was already part of the project.
What worked:
1) Delete app from Simulator (long press and hit X).
2) Also I had to remove old image files from project and then reload the new transparent background images into the project.
Also hit Project > Clean multiple times.
I had the same. Very strange because the simulator displayed the no longer existing
images and the development-phone displayed the correct images.
I had already removed them from the folder. And deleted them from the simulator. For me
a Product > Clean did the trick.
After I did the "remove fromfolder"/"Reset content and setting"/remove app from simulator", I still had an old image hanging around in the simulator. Then I did a "Project>clean". Then the detailViewController.xib file disappeared from the folder. It is still present in XCode, but can not be found anymore when running the app in the simulator, cousing a crash. What is the problem here?
I believe that since Lion, this has changed to '/Users/[user name]/Library/Application Support/iPhone Simulator/[version number]**'. Be careful however, the Library folder is hidden. To view it, open the Terminal and run this:
defaults write com.apple.Finder AppleShowAllFiles YES
I had to
1) Delete the images from the folders.
2) Delete the app from the simulator.
3) Clean.
4) Stop the simulator and restart.
Only when I had done each of these could I get rid of old resources
I had this issue as well. Deleting the app from the simulator (In the simulator do Hardware -> Home, click + hold on app icon till icons jiggle, click the x just like you would do on a device). Running again used the correct images.
Running sudo rm -rf ~/Library/Application\ Support/iPhone\ Simulator/7.*/Applications fixed the problem for me. You might have to change the 7, depending on which version you'll have in ~/Library/Application Support/iPhone Simulator

Resources