How can I tell Spotlight to index my .dSYM bundles? - xcode

Today was the first time that I tried - and failed - to symbolicate a crash log on a newly bought MacBook (let's call this machine MB1). MB1 came with Mac OS X 10.9 pre-installed. I tracked the problem of the failing symbolication down to Spotlight not indexing any of my .dSYM bundles (without the Spotlight index, Apple's symbolicatecrash script fails to locate the .dSYM bundle that matches the crash log). I came to my conclusion because
mdfind "com_apple_xcode_dsym_uuids == *"
does not print anything, although I have several .xcarchive bundles in my ~/Library/Developer/Xcode/Archives folder, and they definitely contain .dSYM sub-bundles whose UUID I can print with dwarfdump --uuid. I also have a couple of .dSYM bundles inside my project's build folder (DerivedData), but none of them are indexed either.
The short and easy question therefore is: How can I tell Spotlight to index my .dSYM bundles?
In case there is no easy answer for this easy question, here is what I have already tried on MB1:
Check permissions of files and folders in ~/Library/Developer/Xcode/Archives (they are all OK, 755 for folders, 644 for files)
Run mdimport ~/Library/Developer/Xcode/Archives (has no effect)
In "System Preferences > Spotlight > Privacy" first add and then remove the ~/Library/Developer/Xcode/Archives folder (has no effect either)
Check with mdutil -s / that indexing is enabled for the volume (it is)
Erase and rebuild the entire index mdutil -E / (takes maybe 10-15 minutes, but still has no effect)
To go into more detail: I have an older MacBook (let's call this machine MB2) that was my dev machine before I switched to MB1. On MB2 I never had any trouble with symbolicating. MB2 had Mac OS X 10.8 installed while I was still actively developing on it, but I recently upgraded MB2 to Mac OS X 10.9.
Today, running mdfind on MB2 still gives me a lot of .dSYM bundles, both from the Archives folder and from the project's DerivedData build folder. These are all old files from the Mac OS X 10.8 days, but apparently Spotlight keeps its index across OS upgrades. I thought it would be interesting to see how Spotlight behaves when new files are created, so I did the following:
Fire up Xcode on MB2, create a new archive, and run mdfind. This finds the intermediate .dSYM bundle inside the DerivedData build folder.
Delete the intermediate .dSYM bundle and run mdfind again. No results this time, i.e. the .dSYM bundle inside the Archives folder is NOT found!
Make a copy of the .xcarchive bundle created in step 1 and place the copy in the root of the user home directory. Run mdfind. This finds the .dSYM sub-bundle within the copied .xcarchive bundle!
At this point, I jumped to the conclusion that because ~/Library is a hidden folder this is what prevents Spotlight from indexing stuff within it. This can be easily confirmed by creating a regular file inside ~/Library and searching for it (no hits), then moving the file outside of ~/Library and searching again (1 hit). Unfortunately, this theory falls flat on its nose because of two reasons:
~/Library was already hidden in Mac OS X versions prior to 10.9, but this never prevented Spotlight from indexing .dSYM files
The "hidden" flag is not all that keeps Spotlight from indexing stuff in ~/Library: If I unhide the folder with chflags nohidden ~/Library, that does not make the regular file visible to Spotlight.
Back to MB1: I tried to repeat step 3 from above, i.e. make a copy of the .xcarchive bundle in the root of the user's home directory, then run mdfind. Surprisingly, on MB1, the result is different from MB2: mdfind still finds no .dSYM bundles whatsoever!
At this point I give up and hope for your help. My conclusion is that Mac OS X 10.9 is somehow responsible for my problems, but for the life of me I can't figure out why this is so. In case it helps, here are a few additional configuration details:
MB1: Xcode 5.0.2 and Xcode 4.6 are installed, 5.0.2 is the default (set with xcode-select). Also installed is Homebrew. The system is a clean install of Mac OS X 10.9.
MB2: Xcode 4.5, 4.6 and 5.0 are installed, 4.6 is the default. Also installed is MacPorts. The system is an upgrade install of Mac OS X 10.9 (previously installed .

Peeking into an Xcode application bundle reveals the following Spotlight importers:
caradhras:~ --> find /Applications/Xcode-5.0.2.app -name \*.mdimporter
/Applications/Xcode-5.0.2.app/Contents/Applications/Application Loader.app/Contents/Library/Spotlight/MZSpotlight.mdimporter
/Applications/Xcode-5.0.2.app/Contents/Library/Spotlight/uuid.mdimporter
Running this command
mdimport -g /Applications/Xcode-5.0.2.app/Contents/Library/Spotlight/uuid.mdimporter ~
finally indexes the .xcarchive bundle that is in the root of the user's home directory. It does NOT index the bundles in ~/Library/Developer/Xcode/Archives, though, even when I explicitly point mdimport to this folder.
The question remains: Why is uuid.mdimporter not run automatically?
EDIT
The solution was to reboot the machine (logout/login might have been sufficient), archive bundles outside of ~/Library are now properly indexed. The reason why I needed to reboot probably is this:
I am using a privileged admin user (A) for installing software, but I am using a different, non-privileged user (U) for normal work, such as developing with Xcode.
I was logged in with user U at the time I installed Xcode with user A
Since that time I have never rebooted, nor made any logins (I prefer sending my machine to sleep over night instead of shutting it down). Presumably, the list of active Spotlight importers is updated (probably by launch services) only when logging out/logging in, or after a reboot.
Anyway, during troubleshooting I found that you can check the list of active Spotlight importers by running mdimport -L (note that different users can have different Spotlight importers active at the same time). Unsurprisingly, after the reboot uuid.mdimporter is now listed, while before the reboot it was not.
Here is a useful Apple document that I found after some googling: Troubleshooting Spotlight Importers.
FINAL SOLUTION
Configure Xcode so that the archive folder is located outside of ~/Library. In Xcode 6 you can do this in the Preferences dialog, under the "Locations" tab.

Related

Mono.framework is missing on my mac ... but it's... there?

Please help me interwebs.
I'm having trouble getting my xamarin app to work. I've done a reinstall of Mac OS X and installed Xamarin using the installer, which adds mono and all the rest of it.
Now when I open up terminal and type which mono i get
/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono
...which is what I expect.
But when I navigate to that place (again in terminal) there's nothing there.
From my root folder I go "cd System/Library/Frameworks " and then hit ls and I get a looooong list of installed frameworks but no Mono.framework.
If I go to Apple > About this Mac > System Report > Frameworks Mono IS listed. I can execute Mono commands on the command line. If I look in paths.d the specified path for mono is /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono but I can't find that location so how is it even a thing?
My linux skills are not great, can anyone please help me understand what's going on here?
I think you are looking in the 'wrong' Library folder. There are a few different Library folders. There is one under the Disk Drive (root) directory, one under the User directory, one under the System directory. I think they are all hidden by default. So you need to set your folder/view options explicitly to show the Library folder since it might be hidden by default. The directory you are looking for is directly under you Disk Drive (root).

On OS X, difference between drag & drop install vs copying to /Applications

I'm trying to automate the install of Xcode on an OS X machine. I've come across this question that got me most of the way.
The script given in the second answer gets the appropriate dmg mounted, and then uses installer to install the pkg. Except these days (e.g. version 7.3.1) Xcode is given as an app bundle inside the dmg, so there is no pkg to install. So I tried to simply copy it to /Applications via
cp -Rf /Volumes/Xcode/Xcode.app /Applications/
The resulting Xcode in my /Applications folder is 9.1 GB. But if I simply rename that bundle, manually open the dmg, and then drag & drop Xcode onto the Application shortcut, I end up with an Xcode that is 10.51 GB in size. Yet when I ask opendiff to compare the two, it tells me the contents are identical...
Does dragging & dropping from a dmg do something else under the hood, besides simply copying the app into /Applications? If so, is there a way to achieve the same via the command line?

MAC OS X bundle with files supposed to reside in /Library Directory

I am new to MAC OS X. I have created a bundle for my app, but two files need to remain in the following two dirs:
/Library/Google/Chrome/NativeMessagingHosts/
/Library/Internet Plugin's/
Both the directories need root access to copy files into them. The first directory may not even exist and needs to be created.
In windows or Linux - setups or deb/rpm packages, it's pretty simple, but I couldn't figure out a way in MAC as every thing is contained in the bundle itself.
This amazing free app "Package" solved my problem
http://s.sudre.free.fr/Software/Packages/about.html

How to fully remove Xcode 4

I want to remove all existing SDK versions as well as Xcode 4.
Xcode 4 Guide says to do this:
sudo /Xcode4/Library/uninstall-devtools --mode=all
But I don't have Xcode4 at this location and the only place I see it is under /Developer/Applications
I've already run the uninstall-devtools that was previously found in /Developer/Applications and then did a reinstall.
What else can I do to completely remove everything and start from scratch?
I use this command:
sudo /Developer/Library/uninstall-devtools --mode=all
Edit (1 year later):
If you've downloaded Xcode from the App Store, it's self-contained, as #mediaslave suggests. You can just drag it to the trash or use AppZapper (or a similar utility) to remove the developer tools.
If you're looking to update it, you can also do that straight through the App Store.
sudo /[xcode-path]/Library/uninstall-devtools --mode=all
Normally, [xcode-path] means /Developer, but if you have multiple versions, for example 3 is the first installed, 4 is second, /Developer will be xcode 3's root derectory and /Xcode4 for xcode 4.
Ensure Xcode, iOS Simulator, and the Mac App Store apps aren't running, then trying running the uninstall script at this (different!) location:
/Library/Developer/Shared/uninstall-devtools
This is where I found it.
Also delete Install Xcode.app from Applications folder, and Empty Trash.
Then run App Store again, and find/install Xcode.
su (or sudo su, whatever)
find / -name uninstall-devtools
This will reveal where the utility is...
If you have XCode 4.3.1, just Move To Trash the XCode.app file in the Applications folder.
If you have installed xcode from Mac App store, then you need to delete it from Launch pad. You can do this by locating xcode icon in launch pad, long click on the icon till it starts dancing. Then delete it and wait for a while till the xcode.app is deleted from /Application. If you manually delete xcode.app from /Application, App store will continue to think its installed and will not allow you to reinstall in future.
I tried to uninstall this by deleting it, but the AppStore still thought that it was installed. I deleted some preferences files in my /private directory, which made the AppStore "forget" that I had installed Xcode. I used the following command:
sudo find / -iname '*xcode*' 2> /dev/null | egrep '^/private.*' | xargs -I file sudo rm -rfv file
Which deleted the following files from my computer:
/private/var/db/receipts/com.apple.pkg.XcodeMAS_iOSSDK_6_1.bom
/private/var/db/receipts/com.apple.pkg.XcodeMAS_iOSSDK_6_1.plist
/private/var/folders/7d/n34963zx62s7znxyzn3dn6bh0000gq/C/com.apple.Xcode.503/CachedSpecifications-Xcode
/private/var/folders/7d/n34963zx62s7znxyzn3dn6bh0000gq/C/com.apple.Xcode.503/CachedSpecifications-xcodebuild
/private/var/folders/7d/n34963zx62s7znxyzn3dn6bh0000gq/C/com.apple.Xcode.503
I do not know what these files are used for, but it made the AppStore forget that it was installed, which is what I needed to happen. In my case, the AppStore was not allowing me to update to the new version of Xcode.

How can I uninstall NetBeans on a mac?

I currently have NetBeans 6.5 installed on my mac running leopard.
I searched Google on how to uninstall it and the NetBeans website says to right click on it, select "Show Package Contents" and the uninstaller should be there, but it isn't.
How can I completely uninstall NetBeans in this situation?
Thanks!
Compiled List
Here is a list of the nooks and crannies where you need to find and delete files and folders. I compiled this list from the multiple sources listed on this page.
My list here was true for me in Mountain Lion 10.8.5 with NetBeans 8.0.2. Of course things may change in the future or past.
Some may not be necessary for some upgrades between versions of NetBeans. But if you want a truly fresh install, here you go.
You could write a shell script to do this deleting. But I just do it by hand as this Spring-cleaning is not a regular occurrence.
I suggest making a back-up copy of each of your projects before doing an upgrade of NetBeans.
Home folder
Some hidden folders may appear directly in your home folder. The . as first letter hides the file/folder by default. To permanently show such files/folders in the Finder, read this or this.
~/.netbeans-derby
In later versions of Mac OS X, the Library folder is hidden from your home folder. Also not displayed on the Go menu. To expose, hold down the Option key while choosing Go. A Library menu item appears, about in the middle of the menu.
~/Library/Application Support/NetBeans/
~/Library/Caches/NetBeans/7.4
Root folder
/Applications/NetBeans
/private/var/db/receipts/org.netbeans.*
Note that NetBeans leaves some hidden configuration directories in your home directory. You might want to delete those too:
.asadminpass and .asadmintruststore - directories that contain stuff for Glassfish (Java EE application server)
.netbeans and .netbeans-registration - NetBeans configuration directories
.nbprofiler - something from the NetBeans profiler
In a terminal window, you can list all files and directories (including hidden ones) with ls -la, and you can delete them with for example rm -rf .netbeans (BE CAREFUL with that last command, it deletes stuff so that you can't get it back).
The instructions on this page say that dragging the Netbeans application out of the Applications folder and into the Trash is sufficient.
Barry Brown's answer is correct; I would add how this is handled by NetBeans. If you look under the NetBeans installation directory, then under bin, you will see a shell script named "netbeans," which locates your JDK installation when NetBeans is started.
There are third party "Uninstaller" utilities for Mac, but dragging an application from "Applictions" to the trash bin is typically how application removal is done.
I think you can uninstall it the same way it is done on Ubuntu as explained in this sample post.
I'm not a Mac user myself, so I may be wrong but it's worth posting this here in case there are Linux users in the house.
Very helpful but if like me you get stuck with a blank 7.1 project because none of the settings ever import it could be that like me you are upgrading a mac osx from 7.0rc1 or 7.0rc2.
To fix this or just re-update your settings.
Open Telnet session.
cd /Users/{user}/. netbeans
ls
I had this...
my-MBP:.netbeans {my}$ ls
6.9 7.0rc2 7.1
my-MBP:.netbeans {my}$
I then removed the duff 7.1 settings and manually moved in the 7.0 settings with
rm -R 7.1
cp -rf 7.0rc2 7.1
When opening up NetBeans next time it will take 2-10 minutes to fully rescan & reindex all but works perfectly after this.
HTH
Simon.

Resources