如何告诉Spotlight为我的.dSYM捆绑软件编制索引? [英] How can I tell Spotlight to index my .dSYM bundles?

查看:98
本文介绍了如何告诉Spotlight为我的.dSYM捆绑软件编制索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天是我第一次尝试-失败-象征新购买的MacBook上的崩溃日志(我们将此机器称为MB1). MB1预先安装了Mac OS X 10.9.我跟踪了失败符号化的问题,直到Spotlight没有为我的任何.dSYM捆绑软件建立索引(没有Spotlight索引,Apple的symbolicatecrash脚本都无法找到与崩溃日志匹配的.dSYM捆绑软件).我之所以得出结论,是因为

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 == *"

尽管在我的~/Library/Developer/Xcode/Archives文件夹中有几个.xcarchive包,但

不打印任何内容,并且它们肯定包含.dSYM子束,我可以用dwarfdump --uuid打印的UUID.我的项目的构建文件夹(DerivedData)中也有几个.dSYM包,但是它们都没有被索引.

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.

一个简短而简单的问题是:如何告诉Spotlight为我的.dSYM包编制索引?

The short and easy question therefore is: How can I tell Spotlight to index my .dSYM bundles?

如果对于这个简单的问题没有简单的答案,这是我已经在MB1上尝试过的内容:

In case there is no easy answer for this easy question, here is what I have already tried on MB1:

  • 检查~/Library/Developer/Xcode/Archives中文件和文件夹的权限(都可以,文件夹为755,文件为644)
  • 运行mdimport ~/Library/Developer/Xcode/Archives(无效)
  • 在系统偏好设置> Spotlight>隐私"中,首先添加然后删除~/Library/Developer/Xcode/Archives文件夹(也无效)
  • 使用mdutil -s /检查是否已为卷启用索引(是)
  • 擦除并重建整个索引mdutil -E /(可能需要10到15分钟,但仍然没有效果)
  • 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)

进入更多细节:在切换到MB1之前,我有一台较旧的MacBook(我们将其称为MB2机器)作为我的开发机器.在MB2上,我使用符号从未遇到任何麻烦.当我仍在积极开发MB2时,MB2已安装了Mac OS X 10.8,但是最近我将MB2升级到了Mac OS X 10.9.

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.

今天,在MB2上运行mdfind仍然给我很多.dSYM包,无论是Archives文件夹还是项目的DerivedData构建文件夹.这些都是Mac OS X 10.8天以来的所有旧文件,但是显然Spotlight会在整个OS升级中保留其索引.我认为查看创建新文件时Spotlight的行为会很有趣,所以我做了以下事情:

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:

  1. 在MB2上启动Xcode,创建一个新的存档,然后运行mdfind.这样会在DerivedData build文件夹中找到中间的.dSYM捆绑包.
  2. 删除中间件.dSYM束,然后再次运行mdfind.这次没有结果,即未找到Archives文件夹内的.dSYM捆绑包!
  3. 制作在步骤1中创建的.xcarchive捆绑软件的副本,并将副本放置在用户主目录的根目录中.运行mdfind.这样会在复制的.xcarchive捆绑包中找到.dSYM子捆绑包!
  1. Fire up Xcode on MB2, create a new archive, and run mdfind. This finds the intermediate .dSYM bundle inside the DerivedData build folder.
  2. 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!
  3. 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!

这时,我得出的结论是,由于~/Library是隐藏文件夹,因此可以防止Spotlight在其中索引内容.通过在~/Library内创建一个常规文件并搜索(没有命中),然后将该文件移到~/Library之外并再次搜索(1个命中),可以轻松确认这一点.不幸的是,由于以下两个原因,该理论不为所动:

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在10.9之前的Mac OS X版本中已经被隐藏,但这从没有阻止Spotlight为.dSYM文件建立索引
  • 隐藏"标志并不能阻止Spotlight为~/Library中的内容编制索引:如果我使用chflags nohidden ~/Library取消隐藏文件夹,则不会使常规文件对Spotlight可见.
  • ~/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.

返回MB1:我尝试从上面重复步骤3,即在用户主目录的根目录中复制.xcarchive捆绑软件的副本,然后运行mdfind.令人惊讶的是,在MB1上,结果与MB2有所不同:mdfind仍然找不到任何.dSYM捆绑包!

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!

在这一点上,我放弃了,希望对您有所帮助.我的结论是Mac OS X 10.9某种程度上导致了我的问题,但是对于我的一生,我不知道为什么会这样.如果有帮助,这里还有一些其他配置详细信息:

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和Xcode 4.6,默认为5.0.2(使用xcode-select设置).还安装了Homebrew.该系统是Mac OS X 10.9的全新安装.
  • MB2:已安装Xcode 4.5、4.6和5.0,默认值为4.6.还安装了MacPorts.该系统是Mac OS X 10.9的升级安装(先前已安装.
  • 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 .

推荐答案

查看Xcode应用程序捆绑包将显示以下Spotlight导入程序:

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

运行此命令

mdimport -g /Applications/Xcode-5.0.2.app/Contents/Library/Spotlight/uuid.mdimporter ~

最终索引位于用户主目录根目录中的.xcarchive捆绑软件.即使我明确将mdimport指向该文件夹,它也不会索引~/Library/Developer/Xcode/Archives中的捆绑包.

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.

问题仍然存在:为什么uuid.mdimporter无法自动运行?

The question remains: Why is uuid.mdimporter not run automatically?

编辑

解决方案是重新引导计算机(注销/登录可能已足够),现在已正确索引~/Library以外的存档捆绑包.我需要重启的原因可能是:

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:

  • 我使用特权管理员用户(A)安装软件,但使用其他非特权用户(U)进行常规工作,例如使用Xcode进行开发.
  • 与用户A一起安装Xcode时,我是用用户U登录的.
  • 自那时以来,我从未重启过计算机,也未进行任何登录(我更喜欢让计算机整夜不睡觉,而不是将其关闭).大概只有在注销/登录时或重新启动后,活动的Spotlight进口商列表才会更新(可能是通过启动服务).

无论如何,在故障排除期间,我发现您可以通过运行mdimport -L来检查活动的Spotlight导入器的列表(请注意,不同的用户可以同时激活不同的Spotlight导入器).毫不奇怪,现在列出了重新启动uuid.mdimporter之后的信息,而没有列出重新启动之前的信息.

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.

以下是我在仔细搜索后发现的有用的Apple文档:对Spotlight导入程序进行故障排除.

Here is a useful Apple document that I found after some googling: Troubleshooting Spotlight Importers.

最终解决方案

配置Xcode,以便存档文件夹位于~/Library之外.在Xcode 6中,您可以在位置"标签下的首选项"对话框中执行此操作.

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.

这篇关于如何告诉Spotlight为我的.dSYM捆绑软件编制索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆