在OS X上使用hdiutil分离卷时出错

时间:2010-10-28 18:26:59

标签: macos terminal volume detach

我有一个在Mac OS 10.5.8上运行的程序。该程序运行一个连续循环,在其中安装映像,安装浏览器插件并再次卸载映像。如果我让这个程序继续运行,我最终会遇到以下错误:“fork:resource暂时不可用”。在活动监视器中,我可以看到数百个名为diskimages-helper的进程正在运行。有谁知道为什么会这样,我怎么能避免它?以下是我在程序的一个周期中使用的命令。

# First I remove the plugin
rm -rf "/Library/Internet Plug-Ins/my.plugin"

# If the mount exists I unmount it
hdiutil unmount [mount] -force

# If that doesnt work I detach the device
hdiutil detach [device] -force

# Then I mount the image
hdiutil mount [image]

# I install the plugin
installer -package [package] -target /

# Unmount
hdiutil unmount [mount] -force

# And if necessary detach
hdiutil detach [device] -force

1 个答案:

答案 0 :(得分:8)

您需要始终分离磁盘映像 - 卸载它卸载文件系统,但将磁盘映像附加到/ dev / disk *条目,并运行diskimages-helper进程来处理它。请注意hdiutil detach将负责为您卸载卷(如果磁盘仲裁正在运行),那么您可以跳过卸载步骤。