xcode 如何使用命令行提取 xip 存档?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40414645/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:32:25  来源:igfitidea点击:

How to extract xip archive using command line?

xcodemacosxcode8osx-elcapitanmacos-sierra

提问by Ninja Inc

I searched around how to extract XIP archive using command line with no luck so I am leaving my own solution, as a bashfunction, here.

我在没有运气的情况下搜索了如何使用命令行提取 XIP 存档,所以我将我自己的解决方案作为一个bash函数,在这里。

I found my inspiration here.

我在这里找到了灵感。

采纳答案by Ninja Inc

function unxip()
{
    [ -z "" ] && echo "usage: unxip /path/to/archive.xip" && return

    # http://newosxbook.com/src.jl?tree=listings&file=pbzx.c
    PBZX="/usr/local/src/pbzx/pbzx" && [ ! -x "$PBZX" ] && echo "$PBZX not found." && return

    [ ! -f "" ] && echo " not found." && return

    [ -f "Content" ] || [ -f "Metadata" ] && echo "Content or Metadata already exists." && return

    pkgutil --check-signature "" && xar -xf "" && "$PBZX" Content | sudo tar x --strip-components=1

    rm "Content" "Metadata"
}

We first check for xipfile signature then extract its contents using xar. We then use Jonathan Levin pbzxto properly unpack pbzxchunks and pipe the output to tar, skipping .to avoid overwriting current working directory permissions.

我们首先检查xip文件签名,然后使用xar. 然后我们使用 Jonathan Levin pbzx正确解包块pbzx并将输出通过管道传输到tar,跳过.以避免覆盖当前工作目录权限。

This does the trick to unpack Xcode8.xiparchives on OS X El Capitan.

这可以Xcode8.xip在 OS X El Capitan 上解压缩档案。

回答by Geoff Nixon

You could try:

你可以试试:

xip -x [path to .xip file]

xip -x [path to .xip file]

回答by Jeff Kelley

On macOS Mojave (not sure about other OS versions), navigate to the directory into which you'd like to expand the contents, then run xip --expand /path/to/xip.xip. For instance:

在 macOS Mojave(不确定其他操作系统版本)上,导航到您想要展开内容的目录,然后运行xip --expand /path/to/xip.xip. 例如:

iMac:Applications jeff$ xip --expand /Users/jeff/Downloads/Xcode_11_Beta.xip

回答by Thi

Use unxip. You can install it with Homebrew:

使用unxip。您可以使用 Homebrew 安装它:

brew install thii/unxip/unxip

To extract a .xipfile:

提取.xip文件:

unxip path/to/.xip

回答by ablarg

open -W archive.xipwill work better since it will then block until the archive has finished opening.

open -W archive.xip会工作得更好,因为它会阻塞,直到存档完成打开。

回答by maskeda

You could just run:

你可以运行:

open archive.xip