OS Xのターミナルから実行できるように7zipをインストールするにはどうすればいいですか

OS Xのターミナルから実行できるように7zipをインストールするにはどうすればいいですか

Mac のコマンド ラインから 7zip を実行できるようにしたいのですが、設定方法について説明している方はいますか?

答え1

インストールするにはp7zip使用して自家製まず、brew数式を更新して、最新のものを入手していることを確認してくださいp7zip

$ brew update

Homebrewを使用してインストールしますp7zip:

$ brew install p7zip

ディレクトリ内のすべてのファイルをsputnik圧縮ファイルに追加しますheed.7z

$ 7z a heed.7z sputnik

解凍heed.7z:

$ 7z x heed.7z

答え2

上の7-zipのダウンロードページOS X にはいくつかのオプションがあります。残念ながら、それらは GUI 付きであるか、現時点では利用できないようです。


ただし、p7zip をダウンロードすることはできます。

p7zipは、独立系開発者によって作成されたUnix/Linux用の7-Zipのコマンドラインバージョンです。

Linuxバイナリとソースコード形式で配布されていますSourceforgeで

ソース コードをダウンロードし、makeアーカイブを抽出したフォルダーで実行します。OS7zaに合わせて自動的にビルドされます。これを動作させるには、Xcode とそのコマンド ライン ツールが必要になる場合があります。

$ cd Downloads/p7zip_9.20.1
$ make
[...]
$ cd bin
$ ls
7za
$ ./7za 

7-Zip (A) [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=de_DE.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)

Usage: 7za <command> [<switches>...] <archive_name> [<file_names>...]
       [<@listfiles...>]

<Commands>
  a: Add files to archive
  b: Benchmark
  d: Delete files from archive
  e: Extract files from archive (without using directory names)
  l: List contents of archive
  t: Test integrity of archive
  u: Update files to archive
  x: eXtract files with full paths
<Switches>
  -ai[r[-|0]]{@listfile|!wildcard}: Include archives
  -ax[r[-|0]]{@listfile|!wildcard}: eXclude archives
  -bd: Disable percentage indicator
  -i[r[-|0]]{@listfile|!wildcard}: Include filenames
  -m{Parameters}: set compression Method
  -o{Directory}: set Output directory
  -p{Password}: set Password
  -r[-|0]: Recurse subdirectories
  -scs{UTF-8 | WIN | DOS}: set charset for list files
  -sfx[{name}]: Create SFX archive
  -si[{name}]: read data from stdin
  -slt: show technical information for l (List) command
  -so: write data to stdout
  -ssc[-]: set sensitive case mode
  -t{Type}: Set type of archive
  -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options
  -v{Size}[b|k|m|g]: Create volumes
  -w[{path}]: assign Work directory. Empty path means a temporary directory
  -x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames
  -y: assume Yes on all queries

$ ./7za a 7za.7z 7za 

7-Zip (A) [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=de_DE.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)
Scanning

Creating archive 7za.7z

Compressing  7za      

Everything is Ok

$ ls
7za    7za.7z

答え3

アーカイブを抽出するだけの場合は、ウナー(The Unarchiver のコマンドライン バージョン) も 7zip をサポートしています。

答え4

p7zipもうメンテナンスされていません。何年も 17.xx のままです。7zip は 23.xx です。すべての CPU コアを活用するなどの重要な機能が欠けています (7zip 17.xx はシングル コアです)

brew install sevenzip元の開発者によってまだメンテナンスされているパッケージをインストールします(7-zip.org より)。

使用するには、7zz --help

関連情報