admin管理员组

文章数量:1558077

macOS 安装 aria2

  • 1,通过Homebrew 安装aria2
  • 2,aria2 两种下载方式
    • 2.1,直接命令行下载
    • 2.2,使用 RPC 模式
  • 3,~~设置aria2 开机启动~~ 有问题

1,通过Homebrew 安装aria2

Install Homebrew

$ brew search aria2
==> Formulae
aria2
$ brew install aria2

2,aria2 两种下载方式

2.1,直接命令行下载

  • 命令行下载种子文件
  • 使用本地torrent文件下载,没有指定下载目录,会下载到当前目录
    Download using a local torrent file
$ aria2c --max-upload-limit=40K /Users/y50/Downloads/Final_Cut_Pro_10.4.6_MAS_TNT.torrent 

04/13 15:05:07 [NOTICE] Downloading 1 item(s)

04/13 15:05:07 [ERROR] Exception caught while loading DHT routing table from /Users/y50/.cache/aria2/dht.dat
Exception: [DHTRoutingTableDeserializer:83] errorCode=1 Failed to load DHT routing table from /Users/y50/.cache/aria2/dht.dat

04/13 15:05:07 [NOTICE] IPv4 DHT: listening on UDP port 6983

04/13 15:05:07 [NOTICE] Allocating disk space. Use --file-allocation=none to disable it. See --file-allocation option in man page for more details.
[#7f77eb 0B/2.7GiB(0%) CN:0 SD:0 DL:0B] [FileAlloc:#7f77eb 2.5GiB/2.7GiB(94%)]                                               
04/13 15:05:15 [NOTICE] IPv4 BitTorrent: listening on TCP port 6967

04/13 15:05:15 [NOTICE] IPv6 BitTorrent: listening on TCP port 6967
[#7f77eb 10MiB/2.7GiB(0%) CN:44 SD:6 DL:0.9MiB ETA:47m50s]     
  • 下载完成 按Ctrl + c 结束下载
[#7f77eb SEED(0.0) CN:5 SD:0 UL:0B(36MiB)]                                                                                   
04/14 00:40:23 [NOTICE] Shutdown sequence commencing... Press Ctrl-C again for emergency shutdown.

04/14 00:40:24 [NOTICE] Download complete: /Users/y50/aria2/Final_Cut_Pro_10.4.6_MAS_[TNT].rar

04/14 00:40:24 [NOTICE] Your share ratio was 0.0, uploaded/downloaded=36MiB/2.7GiB

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
7f77eb|OK  |   0.9MiB/s|/Users/y50/aria2/Final_Cut_Pro_10.4.6_MAS_[TNT].rar

Status Legend:
(OK):download completed.

  • arira2 使用了全部的带宽

2.2,使用 RPC 模式

$ mkdir aria2
$ cd aria2/
$ touch aria2.conf
$ vim aria2.conf

$ cat aria2.conf 只需要修改#dir=/Users/blade/Downloads,选择下载目录

#用户名
#rpc-user=user
#密码
#rpc-passwd=passwd
#上面的认证方式不建议使用,建议使用下面的token方式
#设置加密的密钥
#rpc-secret=token
#允许rpc
enable-rpc=true
#允许所有来源, web界面跨域权限需要
rpc-allow-origin-all=true
#允许外部访问,false的话只监听本地端口
rpc-listen-all=true
#RPC端口, 仅当默认端口被占用时修改
rpc-listen-port=6800
#最大同时下载数(任务数), 路由建议值: 3
max-concurrent-downloads=5
#断点续传
continue=true
#同服务器连接数
max-connection-per-server=5
#最小文件分片大小, 下载线程数上限取决于能分出多少片, 对于小文件重要
min-split-size=10M
#单文件最大线程数, 路由建议值: 5
split=10
#下载速度限制
max-overall-download-limit=0
#单文件速度限制
max-download-limit=0
#上传速度限制
max-overall-upload-limit=0
#单文件速度限制
max-upload-limit=0
#断开速度过慢的连接
#lowest-speed-limit=0
#验证用,需要1.16.1之后的release版本
#referer=*
#文件保存路径, 默认为当前启动位置
#dir=/Users/blade/Downloads
dir=/Users/y50/Downloads
#文件缓存, 使用内置的文件缓存, 如果你不相信Linux内核文件缓存和磁盘内置缓存时使用, 需要1.16及以上版本
#disk-cache=0
#另一种Linux文件缓存方式, 使用前确保您使用的内核支持此选项, 需要1.15及以上版本(?)
#enable-mmap=true
#文件预分配, 能有效降低文件碎片, 提高磁盘性能. 缺点是预分配时间较长
#所需时间 none < falloc ? trunc << prealloc, falloc和trunc需要文件系统和内核支持
file-allocation=prealloc
  • aria2 后台运行
$ aria2c --conf-path="/Users/y50/aria2/aria2.conf" -D
$ ps aux | grep aria
y50               5083   0.0  0.0  4268040    784 s003  S+    2:55下午   0:00.00 grep aria
y50               5060   0.0  0.0  4301436   1136   ??  Ss    2:50下午   0:00.02 aria2c --conf-path=/Users/y50/aria2/aria2.conf -D

使用在线管理工具

  • 点击右上角设置完成保存刷新
    JSON-RPC Path 改为 http://localhost:6800/jsonrpc

  • 下载种子文件
  • 安装chrome插件
  1. Ci-Aria2百度云盘增强版


2. BaiduExporter

  • 报错

3,设置aria2 开机启动 有问题

$ cd ~
$ cd Library/LaunchAgents/
$ touch aria2.plist
$ vim aria2.plist  

$ chmod 644 aria2.plist
$ launchctl load aria2.plist 
$ launchctl start aria2

$ cat aria2.plist aria2.plist 内容

$ which aria2c
/usr/local/bin/aria2c
  • ProgramArguments string 参数为 which aria2c
  • WorkingDirectory string 参数为 aria2c 工作目录
<?xml version="1.0"encoding="utf-8"?>
<!DOCTYPE plist PUBLIC"-//Apple//DTD PLIST 1.0//EN"
"http://www.apple/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>KeepAlive</key>
        <true />
        <key>RunAtLoad</key>
        <true />
        <key>Label</key>
        <string>aria2</string>
        <key>ProgramArguments</key>
        <array>
            <string>/usr/local/bin/aria2c</string>
        </array>
        <key>WorkingDirectory</key>
        <string>/Users/y50/Downloads</string>
    </dict>
</plist>

参考:

  1. aria2官网
  2. Aria2 之 macOS
  3. [Utils] Mac 安装 Aria2
  4. Aria2配置教程(Mac和Windows)
  5. 超简单的Aria2使用教程
  6. Aria2 & YAAW 使用说明
  7. Mac 下开机启动 Aria2
  8. launchd 官网帮助文档

本文标签: 迅雷macOSBitTorrent