Prevent Xcode from keeping an old version of a project folder that I want to rename - xcode

I'm using Xcode Version 6.4 (6E35b)on a mid 2013 MacBook Air running OS X 10.10.5.
A few days ago, with my code in something of a tangle, Xcode crashed. After the crash, my app built and ran, but didn't do anything except eat memory at a fantastically fast rate.
I keep a git repository and every now and then a put a copy of the whole project folder on an offsite location.
I got one of my older versions out of storage, did a build and run and the same thing happened.
All copies of the same project (by name) now do the same thing. Run, eat memory, and nothing else.
I tried removing DerivedData, removing contents of /var/folders/, removing and replacing schema (in schema -> manage), removing all projects, emptying trash, and have removed Xcode (using "trash me") and reinstalling. No joy. Still the same thing.
I was wanting to change the name of the project anyhow, so I changed the name, and it works. Unfortunately, I can't seem to change the name of the folder containing the project. Using the file inspector, I'm able to change the names of almost everything, but info.plist wants to keep an extra copy of the old project folder name in it's path, as far as DerivedData and LLVM are concerned.
Right now I will continue working with the old project folder name, but new project name.
How do I make Xcode forget the old folder name?

As edited by John Caswell, the answer is basically covered by a careful reading of Duplicate and rename Xcode project & associated folders. I'm going to close this and resubmit the parts of the question that aren't answered.

Related

Xcode 7.3 taking too much space [duplicate]

After going through and cleaning my disk with old things that I didn't need anymore, I came across the iOS DeviceSupport folder in ~/Library/Developer/Xcode which was taking nearly 20 GB.
A similar question has been asked before, but since then many things have changed and I would like an up-to-date answer.
As long as I have the version I use for testing, can I delete the older/unused versions without breaking anything?
The ~/Library/Developer/Xcode/iOS DeviceSupport folder is basically only needed to symbolicate crash logs.
You could completely purge the entire folder. Of course the next time you connect one of your devices, Xcode would redownload the symbol data from the device.
I clean out that folder once a year or so by deleting folders for versions of iOS I no longer support or expect to ever have to symbolicate a crash log for.
More Suggestive answer supporting rmaddy's answer as our primary purpose is to delete unnecessary file and folder:
Delete this folder after every few days interval. Most of the time, it occupy huge space!
~/Library/Developer/Xcode/DerivedData
All your targets are kept in the archived form in Archives folder. Before you decide to delete contents of this folder, here is a warning - if you want to be able to debug deployed versions of your App, you shouldn’t delete the archives. Xcode will manage of archives and creates new file when new build is archived.
~/Library/Developer/Xcode/Archives
iOS Device Support folder creates a subfolder with the device version as an identifier when you attach the device. Most of the time it’s just old stuff. Keep the latest version and rest of them can be deleted (if you don’t have an app that runs on 5.1.1, there’s no reason to keep the 5.1.1 directory/directories). If you really don't need these, delete. But we should keep a few although we test app from device mostly.
~/Library/Developer/Xcode/iOS DeviceSupport
Core Simulator folder is familiar for many Xcode users. It’s simulator’s territory; that's where it stores app data. It’s obvious that you can toss the older version simulator folder/folders if you no longer support your apps for those versions. As it is user data, no big issue if you delete it completely but it’s safer to use ‘Reset Content and Settings’ option from the menu to delete all of your app data in a Simulator.
~/Library/Developer/CoreSimulator
(Here's a handy shell command for step 5: xcrun simctl delete unavailable )
Caches are always safe to delete since they will be recreated as necessary. This isn’t a directory; it’s a file of kind Xcode Project. Delete away!
~/Library/Caches/com.apple.dt.Xcode
Additionally, Apple iOS device automatically syncs specific files and settings to your Mac every time they are connected to your Mac machine. To be on safe side, it’s wise to use Devices pane of iTunes preferences to delete older backups; you should be retaining your most recent back-ups off course.
~/Library/Application Support/MobileSync/Backup
Source: https://ajithrnayak.com/post/95441624221/xcode-users-can-free-up-space-on-your-mac
I got back about 40GB!
I wrote a small command-line utility based on the great answer by #JamshedAlam for those who are tired of deleting the contents of those folders manually. Check it out here if you think it would help you.
Yes, you can delete data from iOS device support by the symbols of the operating system, one for each version for each architecture. It's used for debugging.
If you don't need to support those devices any more, you can delete the directory without ill effect

Eclipse - bin Folder keeps creating itself

This is a long one, but please, bear with me. I really need help here.
I use Eclipse (latest version) to play with some programs of my own. During installation (?), it asked me where I'd like to put in my Workspace folder. I set it to default, but, not wanting to dig through Documents and such (I have my own Documents folder on another drive), I made sure that every project I have is condensed into one "Projects" folder, not in the Workspace. My "Projects" folder contains every program I've coded so far, from C# to Java, as well as the necessary tools, like the Eclipse folder.
It worked fine for me, until I decided I want to do another project. So, I navigated to my "Projects" folder, and then created it there.
Now for some reason, Eclipse treated the directory I navigated to as my project folder. As in, new folders like bin, src, etc. started popping up in my otherwise organized folder. Visual Studio does not have this problem, and actually creates a new folder for your project under whatever directory you set it to.
So I, in a 'Monday blues' move, went into Eclipse and deleted my project. Eclipse wasted no time in deleting my entire "Projects" folder and everything in it - including itself, apparently. Gah.
I quickly closed Eclipse, but it kept saying something about 'Saving Workspace' which I assumed meant "Don't close me yet, I'm still deleting your files."
I thought I was being sensible when I terminated it via the Task Manager. It stopped deleting my stuff, but out of the dozen or so programs, I only managed to save three.
Wanting to start over again, I deleted (what's left of) my Eclipse, so I can 'install' it again, and let it have its way of where to create projects and save my files, so that this doesn't happen again. Unfortunately, one folder keeps returning no matter how many times I delete it. The aforementioned bin folder, a name that needs at least two adjectives and the suffix "Of the Damned."
So, to summarize:
I lost majority of my programs.
I lost my Eclipse.
And folder 'Bin' keeps popping up.
And so I'd like to ask:
Can I recover my files?
How can I setup Eclipse so that it creates a new project folder when I create a new project instead of treating the directory as the project folder?
How can I permanently get rid of that haunted Bin folder?
If anyone an help out here, thank you so much. This has easily been one of my worst Mondays.
As of now, I have tried:
Restarting my PC (didn't work, Bin Folder is still there)
Downloading and running a new copy of Eclipse (didn't work either)
I have struggles also on my Eclipse for the past few weeks. I answer each of your question below, hope that helps.
Can I recover my files? - If your programs are not physically removed from disk, you can add it back when you have your Eclipse running
How can I setup Eclipse so that it creates a new project folder when I create a new project instead of treating the directory as the project folder? - Create your project by clicking File->New->Android Application Project (if android). Then input the application name,etc. Click Next and uncheck create project in workspace, from there you can have your own location or directory of your project.
How can I permanently get rid of that haunted Bin folder? - In may case, I downloaded a fresh copy of Eclipse. I used the adt bundle which can be downloaded here: http://developer.android.com/sdk/index.html
the sad news is, that Eclipse does not just delete the projects into the bin, like it would happen with the "delete" by clicking on the folder and manually deleting it. You could try with recovery software, but it is not an assurance it will work, or recover all your lost data.
For the more of it, in the Bin folder that is made automatically in any Java project, you get compiled classes which are what gets packaged/archived into any jars that are created.(I hope this makes sense, I couldn't find a better way to explain myself.)
For the set-up of Eclipse I would have a look at the page of Eclipse, maybe a forum, or a FAQ is there.
I for instance use Netbeans, which does from the start always create a new folder for the new projects.
I hope I could somehow help!Here a little link to a recovery software that has a good reputation: http://www.piriform.com/recuva
Kind regards,
DomExtra edit: Version Control is an awesome tool to save your buttex from trouble like this ;)

Xcode build products folder won't change to Unique

I don't recall having this problem before I migrated to my Retina MacBook Pro, but since doing so, my projects have insisted on loading in the "old" development location. In years past, before XCode 4, we put all our products in /Development/Products. And, after migrating to the new MacBook Pro, they're going back there again. I can use 4.3 or newer and see the same problem with both, so I'm assuming it's some kind of configurable that's at work here.
Of course, the first thing I did was verify that the Preferences/Locations was set to Build Location = Unique. I confirmed this both in the GUI and by popping open the .plist to check the value of IDEBuildLocationStyle and it was set to Unique.
I tried removing my existing configuration files (everthing in ~/Library/Preferences/ named Xcode) and that succeeded in changing the behavior to putting the output in the build directory of the project itself (really not helpful in my world as I have complex multi-project workspaces). Quitting and checking the settings, they were set for IDEBuildLocationStyle=Unique.
So, I copied the working configuration from another machine I had to this one. Since it too had previously had the /Development/Products destination, but had subsequently been moved to the Unique build style, I expected that to work. It did not. It instead returned the output to /Development/Products.
Thinking it might be something with my Xcode install, I created a new user and built from the same source tree (not a duplicate, not a copy, the exact same files). In this case, the output went to the right place (unique subdirectory of the Derived Products for that user). So, I blew away the ~/Preferences/*Xcode* again and copied in the preferences from the new user. Unfortunately, this took us back to the same behavior that the uninitialized configuration had, which is to say building in the build directory of the project itself.
I restored to my backup configuration files, and now I'm back to working at /Development/Products, but this isn't a good long term solution.
When checking the script output for a test script, I can clearly see that somebody is setting SYMROOT to /Development/Products in the case of the older config, and build in the case of the default configuration file.
Clearly there's something here on this system that's influencing the configuration, but I cannot figure out what it is. Any assistance would be highly appreciated!
Also - When I try to use option-Clean to enable Clean Build Folder, it is never enabled, which makes a certain kind of sense, but I thought it might be another data point.
I tried the solution in Strange behavior of Xcode Build Products Path under Build Locations and that had the same result as deleting the preferences: build products as children of the project directory.
Has anyone else seen such a problem? Have you found a solution?
Well, after a very long time of suffering through this on my laptop, I was finally able to track down the problem.
Inside of:
project.xcworkspace/xcuserdata/<user>.xcuserdatad/
there is a WorkspaceSettings.xcsettings file.
It contained a key BuildLocationStyle, which was set to UseTargetSettings.
Deleting the file and thus resetting this value allowed me to get both the Clean Build Folder... working and to get my project building correctly.
Hopefully this will help somebody else.

Why is Xcode's Search Navigator searching the wrong project's files?

I have a large Xcode project for a game I'm building. I recently switched versions of the animation framework I'm using (cocos2d), and to keep things clean, I went ahead and created a brand new Xcode project from scratch.
Afer creating the new project file, I made copies of all my source files in the filesystem, then symlinked them into the new project by dragging them into the Xcode Project Navigator. Everything worked fine.
But here's where it gets weird. Whenever I use the Xcode Search Navigator to do global text searches on my project, it searches files from the old project! And only files from the old project!
The only conceivable explanation I can come up with is that Xcode is somehow recognizing my filenames as being the same as were used in the old project, and has decided to ignore the newer versions in favor of the old ones. Is there any such cache or preference within Xcode that can do such a thing? Keep in mind the paths are different, since the new project's files all exist in a brand new directory. But the class names are the same.
In case this is relevant: I once created an Xcode Workspace that included the old version of this project (but not the new one.) I abandoned the workspace long ago as it was problematic, in favor of working with the project directly.
UPDATE: This appears to be an Xcode-related problem-- I have discovered I have the same lack of search-ability in all of my projects. I uninstalled Xcode (I had the version that was still using the Developer directory) and installed the latest version (4.3.3) that does not use the developer directory, but I am still seeing this problem.
I am curious if anyone knows a way to wipe out Xcode's cache of project code indexes, if such a thing exists, that might potentially "reset" its knowledge of my projects and thus fix the situation. Possibly something in the Library directory?
One last clue as to what might be happening: In addition to the search navigator failures, I noticed one of my projects was still using resources that no longer existed in the filesystem-- again, making me think Xcode has cached information about my projects somewhere and is now using outdated versions of my files that no longer exist. this post helped me solve that problem by resetting the simulator's content and settings, but the search issue persists.
Have you checked your Find Options? This same problem was biting me and then I remembered I had added a custom Scope in 'My Scope' that directed XCode to my other project. Changing this back to 'Workspace' fixed the problem.

Delete an unreferenced image from repository in Xcode

I deleted default.png from my resources folder because I wanted a different image for the loading screen, but I just deleted the reference which was apparently a dumb thing to do. I dragged the new image into resources and tried to change the name to Default.png, but it won't let me, which I think is because the first Default.png is still in the repository somewhere. Anyway, how do I delete that image(and others with which I have probably done the same thing) from the repository when it is no longer visible in xcode?
What kind of repository is it? Subversion? Git?
The SCM integration in Xcode is great for checking out files and committing changes without having to leave the IDE, but it's hardly a full-blown GUI front end to either svn or git. It may be possible to fix your mistake by adding the file back to the project and then deleting it in Xcode in such a way that Xcode will remove it from the repository for you, but the simple solution is to just delete the file from the repository yourself by using the appropriate version control command. For example, if you're using Subversion you could:
svn remove default.png
to remove the file from your version of the repository. When you commit your changes, the file will be deleted in that version. (It'll still exist in previous versions -- that's the whole point of SCM, after all.)
After that, you can create the new file and add it to both the project and the repository in the usual way.
You need to manually go into your app's file structure and delete the image files themselves. Also, it is usually a good idea to "clean" the app whenever you remove files or references to files from an XCode project, since XCode can be a bit temperamental about removing files; the key combination for this is
Hope this fixes your problem.
Clean all targets should work (at least it worked for me). You can try the following:
a) delete the reference from "Copy Bundle resources" of your target
b) delete the app from Simulator/Device
c) clean all targets
Caleb is absolutely right. That fixed the problem here as well for the most files.
An easier way to get an overview of the accidentally un-deleted files, is creating a bookmark of the working copy with Versions (SVN Software - in case you use SVN). There you can detect the problematic files grafically and delete them. I always have to do this after restructuring the project folder.

Resources