卷曲 | tar - gzip: stdin: 不是 gzip 格式

curl | tar - gzip: stdin: not in gzip format

我正在尝试使用以下命令在 travis 上安装 ffmpeg:

curl http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz | tar -C /usr/local/bin/ -xvz

我收到这个错误:

$ curl http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz | tar -C /usr/local/bin/ -xvz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time      Current
                                 Dload  Upload   Total   Spent    Left      Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
gzip: stdin: not in gzip format
tar: Child died with signal 13
tar: Error is not recoverable: exiting now
The command "curl http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz | tar -C /usr/local/bin/ -xvz" failed and exited with 2 during .

但是,它在 OS X 上本地运行。发生了什么事?

.xz 不是 .gz。 GNU tar 显然可以识别 XZ 格式;但是 OS X 不使用 GNU 工具。我发现 this quote:

Without installing anything, a TAR archive can be created with XZ compression using the tar program with the undocumented --xz argument.

您的 tar 可能无法处理 .xz 个文件。

根据this link,您可以尝试安装 xz-utils 并使用 -J 标志:

tar -C /path/to/output -xJv

我好像用错命令了!应该是

curl http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz | sudo tar -C /usr/local/bin/ -xJ --strip-components=1