bash - 有没有办法像 tar.gz 文件一样解压缩 dmg 文件?(使用 Mac 操作系统)
问题描述
我正在尝试使用使用 Linux 版本的其他程序的程序。我在 bash 中运行了这个:
c3dpath=$( command -v c3d )
if [[ -z "${c3dpath}" ]]; then
echo "Command c3d was not found. Downloading and installing software to ${SCRIPTPATH}/depends/c3d. Path will be added to PATH environment variable."
mkdir -p "${SCRIPTPATH}/depends/c3d/"
wget https://downloads.sourceforge.net/project/c3d/c3d/Nightly/c3d-nightly-Linux-x86_64.tar.gz && \
tar -xzvf c3d-nightly-Linux-x86_64.tar.gz && mv c3d-1.1.0-Linux-x86_64/* "${SCRIPTPATH}/depends/c3d/" && \
rm c3d-nightly-Linux-x86_64.tar.gz
export PATH="${SCRIPTPATH}/depends/c3d/c3d-1.1.0-Linux-x86_64/bin/:$PATH"
fi
但它将程序文件的 linux 版本下载到我的目录中 - 产生错误:
{..omitted}/HippMapp3r/depends/c3d/bin/c3d: cannot execute binary file
Return Code: 126
我知道为了让它在我的计算机上运行,我需要使用 Mac OS 的版本,但是,我坚持如何“取消归档”包含在 .dmg 文件中的文件,以便我可以访问 bin 中的 c3d .
我对此进行了编辑,但我知道我不能在这种情况下使用 tar -xzvf 命令——是否有与 tar -xzvf 等效的“解包”dmg 文件?
c3dpath=$( command -v c3d )
if [[ -z "${c3dpath}" ]]; then
echo "Command c3d was not found. Downloading and installing software to ${SCRIPTPATH}/depends/c3d. Path will be added to PATH environment variable."
mkdir -p "${SCRIPTPATH}/depends/c3d/"
wget https://downloads.sourceforge.net/project/c3d/c3d/Nightly/c3d-nightly-MacOS-x86_64.dmg && \
tar -xzvf c3d-nightly-MacOS-x86_64.dmg * "${SCRIPTPATH}/depends/c3d/" && \
rm c3d-nightly-MacOS-x86_64.dmg
export PATH="${SCRIPTPATH}/depends/c3d/c3d-nightly-MacOS-x86_64/bin/:$PATH"
fi
解决方案
首先,您必须安装 DMG 文件。命令:hdiutil mount test.dmg
推荐阅读
- c++ - 类中的模板参数
- bash - Bash XSV 使用 CSV 列自动填充空值
- google-cloud-firestore - 是否有任何与 rails ActiveRecord 迁移相当的 Firestore 数据库模式迁移概念?
- blender - 在为 OBJ 着色后将纹理导出为 png
- kiwi-tcms - 更改测试用例后,测试运行中的测试用例未更改。它是否按设计工作?
- javascript - Internet Explorer 弹出消息在 Windows 10 中被截断
- javascript - 在 React 中使用 Jest 对 onClick 处理程序进行单元测试
- ios - 如何编辑字形图像图标 Swift 4?
- javascript - Javascript:绑定/取消绑定函数行为
- android - 在剩余空间中查看以填充和居中内容 Android