ブログ - 7zipのパッケージをインストール
7zip形式のファイル7zを受け取ったけれど,macOS Mojaveだとツールが入ってないので入れてみた.
まずはパッケージを検索.
p7zipが該当する模様.パッケージを確認.
過去30日で19,502件ダウンロードなので,いいものだろうと思われる.
インストールする.
インストールされたディレクトリを確認する.
7zコマンドなどがあった.
ファイルパスが通っているか確認.
7zコマンドのヘルプを確認.
インストールできたので,.7zファイルを展開する.
ファイルを展開(解凍)する際には,xオプションを使う.
パスワード付き7zファイルも対応していた.
まずはパッケージを検索.
$ brew search 7zip🆑
==> Formulae
p7zip
[macmini2014:ujpadmin 14:07:07 ~ ]
$
[macmini2014:ujpadmin 14:07:11 ~ ]
$ brew info p7zip🆑
p7zip: stable 16.02 (bottled)
7-Zip (high compression file archiver) implementation
https://p7zip.sourceforge.io/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/p7zip.rb
License: LGPL-2.1-or-later and GPL-2.0-or-later
==> Analytics
install: 24,531 (30 days), 58,693 (90 days), 167,272 (365 days)
install-on-request: 19,502 (30 days), 46,053 (90 days), 129,176 (365 days)
build-error: 0 (30 days)
[macmini2014:ujpadmin 14:07:18 ~ ]
$
インストールする.
[macmini2014:ujpadmin 14:07:46 ~ ]
$ brew install p7zip🆑
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae
Updated 30 formulae.
==> Updated Casks
Updated 7 casks.
==> Deleted Casks
racket-cs
==> Downloading https://homebrew.bintray.com/bottles/p7zip-16.02_3.mojave.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/971a247c66fae4b54fdf169fdea79b79a85af6a8d6dc01a3119df014a
######################################################################## 100.0%
==> Pouring p7zip-16.02_3.mojave.bottle.tar.gz
🍺 /usr/local/Cellar/p7zip/16.02_3: 102 files, 4.4MB
[macmini2014:ujpadmin 14:08:32 ~ ]
$
$ ls -la /usr/local/Cellar/p7zip/16.02_3/🆑
total 60
drwxr-xr-x 10 ujpadmin staff 320 2 15 14:08 .
drwxr-xr-x 3 ujpadmin staff 96 2 15 14:08 ..
drwxr-xr-x 3 ujpadmin staff 96 7 14 2016 .brew
-rw-r--r-- 1 ujpadmin staff 39517 7 14 2016 ChangeLog
-rw-r--r-- 1 ujpadmin staff 821 2 15 14:08 INSTALL_RECEIPT.json
-rw-r--r-- 1 ujpadmin staff 12069 2 15 14:08 README
-rw-r--r-- 1 ujpadmin staff 704 7 14 2016 TODO
drwxr-xr-x 5 ujpadmin staff 160 2 15 14:08 bin🈁
drwxr-xr-x 3 ujpadmin staff 96 7 14 2016 lib
drwxr-xr-x 4 ujpadmin staff 128 7 14 2016 share
[macmini2014:ujpadmin 14:09:32 ~ ]
$ ls -la /usr/local/Cellar/p7zip/16.02_3/bin🆑
total 12
drwxr-xr-x 5 ujpadmin staff 160 2 15 14:08 .
drwxr-xr-x 10 ujpadmin staff 320 2 15 14:08 ..
-r-xr-xr-x 1 ujpadmin staff 63 2 15 14:08 7z🈁
-r-xr-xr-x 1 ujpadmin staff 64 2 15 14:08 7za
-r-xr-xr-x 1 ujpadmin staff 64 2 15 14:08 7zr
[macmini2014:ujpadmin 14:09:36 ~ ]
$
ファイルパスが通っているか確認.
$ which 7z🆑
/usr/local/bin/7z🈁
[macmini2014:ujpadmin 14:09:56 ~ ]
$ ls -la /usr/local/bin/7z🆑
lrwxr-xr-x 1 ujpadmin admin 30 2 15 14:08 /usr/local/bin/7z -> ../Cellar/p7zip/16.02_3/bin/7z🈁
[macmini2014:ujpadmin 14:10:05 ~ ]
$
$ 7z -h🆑
7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=utf8,Utf16=on,HugeFiles=on,64 bits,4 CPUs x64)
Usage: 7z <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)
h : Calculate hash values for files
i : Show information about supported formats
l : List contents of archive
rn : Rename files in archive
t : Test integrity of archive
u : Update files to archive
x : eXtract files with full paths🈁
<Switches>
-- : Stop switches parsing
-ai[r[-|0]]{@listfile|!wildcard} : Include archives
-ax[r[-|0]]{@listfile|!wildcard} : eXclude archives
-ao{a|s|t|u} : set Overwrite mode
-an : disable archive_name field
-bb[0-3] : set output log level
-bd : disable progress indicator
-bs{o|e|p}{0|1|2} : set output stream for output/error/progress line
-bt : show execution time statistics
-i[r[-|0]]{@listfile|!wildcard} : Include filenames
-m{Parameters} : set compression Method
-mmt[N] : set number of CPU threads
-o{Directory} : set Output directory
-p{Password} : set Password
-r[-|0] : Recurse subdirectories
-sa{a|e|s} : set Archive name mode
-scc{UTF-8|WIN|DOS} : set charset for for console input/output
-scs{UTF-8|UTF-16LE|UTF-16BE|WIN|DOS|{id}} : set charset for list files
-scrc[CRC32|CRC64|SHA1|SHA256|*] : set hash function for x, e, h commands
-sdel : delete files after compression
-seml[.] : send archive by email
-sfx[{name}] : Create SFX archive
-si[{name}] : read data from stdin
-slp : set Large Pages mode
-slt : show technical information for l (List) command
-snh : store hard links as links
-snl : store symbolic links as links
-sni : store NT security information
-sns[-] : store NTFS alternate streams
-so : write data to stdout
-spd : disable wildcard matching for file names
-spe : eliminate duplication of root folder for extract command
-spf : use fully qualified file paths
-ssc[-] : set sensitive case mode
-ssw : compress shared files
-stl : set archive timestamp from the most recently modified file
-stm{HexMask} : set CPU thread affinity mask (hexadecimal number)
-stx{Type} : exclude archive type
-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
[macmini2014:ujpadmin 14:10:12 ~ ]
$
ファイルを展開(解凍)する際には,xオプションを使う.
$ 7z x virus.zip.7z🆑
7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=utf8,Utf16=on,HugeFiles=on,64 bits,4 CPUs x64)
Scanning the drive for archives:
1 file, 53103 bytes (52 KiB)
Extracting archive: virus.zip.7z
--
Path = virus.zip.7z
Type = 7z
Physical Size = 53103
Headers Size = 127
Method = Copy 7zAES
Solid = -
Blocks = 1
Enter password (will not be echoed):🔑🔑🔑🔑🔑
Everything is Ok
Size: 52962
Compressed: 53103
[macmini2014:ujpadmin 14:28:17 ~ ]
$