# 快照实例2:smartmontools

前面是一个最简单的拖拽一个App到应用文件夹的操作。本节以一个稍微复杂的安装包安装过程为例，再来审视Composer的应用场景。&#x20;

在Mac环境中，测试硬盘的S.M.A.R.T.状态并给出详细信息的软件不如Windows上那么多，尤其是硬盘生产商基本都是只提供Windows版的测试软件，而且免费的更少了。不过，smartmontools作为一个命令行的软件适合于几乎所有的现代操作系统中，它可以支持ATA/SATA, SCSI/SAS 和NVMe等等的硬盘。

它官网（[www.smartmontools.org）有现成的封装好的pkg可以免费下载和使用（如果读者找不到，可以使用这个网址去下载，](http://www.smartmontools.org）有现成的封装好的pkg可以免费下载和使用（如果读者找不到，可以使用这个网址去下载，)<https://sourceforge.net/projects/smartmontools/files/smartmontools>），本书使用6.6-1版本。当然也可以使用homebrew安装。而它的最新测试版，到这里来（<https://builds.smartmontools.org/）>

一个叫Alex Shaduri制作了个前端图形界面软件[GSmartControl](https://gsmartcontrol.sourceforge.io/home) （<https://gsmartcontrol.sourceforge.io/home/）需要用homebrew安装了。本书暂不涉及它的安装使用。>

因为macOS系统的原因，要访问USB外置盘，需要另外安装一个软件SATSMARTDriver。目前，它主要有两个发行版本0.8和0.10。一般来说，0.8版可以使用绝大多数情况，如果不兼容，再使用0.10版本。请到网站<https://binaryfruit.com/drivedx/usb-drive-support>看其他说明和下载。本书使用版本下载链接为：<https://binaryfruit.com/download/mac/satsmartdriver/SATSMARTDriver-0.8.zip>

两个安装包准备好之后，就可以进行下一步了。 这里省略与前一节重复的步骤。到安装步骤时，我们安装smartmontools.pkg：

![](https://1294730624-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L_jmRBOs2_KzL4qlhkA%2F-LafBkWaa6rQyhVq4_zr%2F-LafSb_0Z6ilhyFCsVBV%2Fimage.png?alt=media\&token=827cb0f1-57df-43c6-b2cf-978e04c7cbf5)

安装完成之后，再进行第二次的快照，知道完成Composer的所有步骤，经过清理不必要的文件和目录之后，可以得到类似下图的结果：

![](https://1294730624-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L_jmRBOs2_KzL4qlhkA%2F-LafBkWaa6rQyhVq4_zr%2F-LafSeUuZ5jtOnIsWysK%2Fimage.png?alt=media\&token=7ed15086-4d7f-41ed-a256-5a9e39740b88)

这就是smartmontools安装包所安装的所有文件。&#x20;

作业：

* [ ] 请读者自己考虑如何判断一个目录是否是应该包含在项目中
* [ ] 请读者自己制作安装了smartmontools和SATSMARTDriver两个安装包的综合项目
* [ ] 在前例中，不仅仅复制App到应用文件件，并且运行一次，让它完成初始化和配置，然后在制作一个新项目，并比较前后两次的差异
* [ ] 思考：通过对Alfred初始化后项目的分析，看看他是如何实现用户登陆后自动运行的
* [ ] 思考：对当前用户快照的抓取，是否能适用于其它macOS系统的不同用户？有没有限制？限制是什么？


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tonyliu.gitbook.io/macos-packaging/di-san-zhang-zhong-zhuang-chu-fa/kuai-zhao-zhong-xin-da-bao/kuai-zhao-shi-li-2smartmontools.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
