MacOS安装homeBrew及监控实时功耗
介绍了如何在ARM芯片上安装homebrew。最初写于2022年,基于MacMini。2024年更新为基于Macbook air,并且用homebrew安装asitop来监控MacBook的实时功耗,安装smartmontools来查看查看磁盘的写入与读取。
20241205更新:
homebrew的好处是一个命令就能下载软件,而且会自动配好环境变量。下载时实际上不需要修改host,只要clashx开启增强模式,直接运行install就没问题。还需要注意的是安装完需要按照提示添加环境变量。在命令行依次输入
echo » /Users/rao/.zprofile
echo ’eval “$(/opt/homebrew/bin/brew shellenv)”’ » /Users/rao/.zprofile
eval “$(/opt/homebrew/bin/brew shellenv)”
安装完后硬盘剩余空间对比
最主要的是xcode的command line,占用了2.37G。
利用smartmontools查看硬盘写入量
brew install smartmontools
smartctl -a disk0 | awk '/SMART\/Health Information/,/^$/'
20241205日结果如下:
SMART/Health Information (NVMe Log 0x02)
Critical Warning: 0x00
Temperature: 35 Celsius
Available Spare: 100%
Available Spare Threshold: 99%
Percentage Used: 0%
Data Units Read: 6,991,706 [3.57 TB]
Data Units Written: 3,203,066 [1.63 TB]
Host Read Commands: 162,196,009
Host Write Commands: 65,625,988
Controller Busy Time: 0
Power Cycles: 91
Power On Hours: 131
Unsafe Shutdowns: 6
Media and Data Integrity Errors: 0
Error Information Log Entries: 0
分析输出结果
运行上面的命令后,会得到以下输出,其中的**Percentage Used(磁盘使用百分比)和Data Units Written(磁盘写入量)**就是我们要关注的值:来源:https://www.jindouyun.cn/document/industry/details/181427
|
|
如果你要查看别的磁盘,请运行下面的命令查找磁盘标志符(输出结果最后一列IDENTIFIER)
|
|
禁用homebrew的自动更新
安装asitop监控系统功耗
通过homebrew
通过python
2022年(无需科学上网版安装homebrew)
为了以后下载软件的方便,先按照http://mirrors.ustc.edu.cn/help/brew.git.html的方式修改源:
在终端输入
再输入
|
|
此时大概率会出现如下错误
要解决需要修改host文件,到 ipaddress.com/ 查询 http://raw.githubusercontent.com 的真实IP,再按以下格式修改hosts:
再次执行命令即可。