Mac uses rar command line tool to decompress and compress files

Commonly encountered compressed files on Mac are in zip and rar format. If it is in zip format, the Mac system can directly decompress it by double-clicking the file by default, but this does not work for rar files.

You need to download additional rar tool for implementation.

Step 1: Download rar tool

Tool URL: https://www.rarlab.com/download.htm

Then choose the corresponding version according to your system and download it directly.

image.png

After downloading and unzipping, you will get a rar folder, as shown in the figure:

image.png

Step 2: Install rar tool

There are two main steps, namely the compression command and the decompression command.

First enter the rar folder path, and then execute the following two commands respectively.

sudo install -c -o $USER rar /usr/local/bin/
sudo install -c -o $USER unrar /usr/local/bin

Step 3: Use rar tool

3.1 Unzip

Use the following command to decompress the specified file.

unrar x abc.rar

3.2 Compression

Use the following command to compress the specified file.

rar a 压缩后的文件名称.rar 文件1 文件2

Note: Security and Privacy

Need to go to 系统偏好设置–> 安全与隐私to select仍要打开

Guess you like

Origin blog.csdn.net/qq_41340258/article/details/132379841