If you are using a Mac with Apple Silicon (M1/M2) and want to start and stop the Aria2 download manager as a service using Homebrew, this tutorial is for you. We will walk you through the process of creating the necessary file for Aria2 to work seamlessly with Homebrew on your Mac M1/M2 device.
Ensure that you have Aria2 and Homebrew installed on your Mac. If you haven't installed them yet, you can follow the installation instructions on their respective websites:
- Homebrew: https://brew.sh/
- Aria2: install using
brew install aria2
- AriaNG: Optionally GUI for easy management install using
brew install ariang
To enable the brew services
commands for Aria2, you will need to create a service file under the Aria2 installation directory in Homebrew. Follow these steps:
- Open Terminal on your Mac.
- Navigate to the Aria2 installation directory in Homebrew. In this example, the Aria2 version is 1.36.0_1. Adjust the path accordingly if you have a different version installed:
cd /opt/homebrew/Cellar/aria2/1.36.0_1/
- Create a new file called
homebrew.mxcl.aria2.plist
in this directory. You can use a text editor likenano
orvim
to create and edit the file:
nano homebrew.mxcl.aria2.plist
OR
# Direct download link for homebrew.mxcl.aria2.plist file
curl -LRO https://gist.github.com/yashodhank/f18c5e545d6c2babc941c847e2003ca7/raw/homebrew.mxcl.aria2.plist
- Populate the file with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>RunAtLoad</key>
<true/>
<key>Label</key>
<string>homebrew.mxcl.aria2</string>
<key>ProgramArguments</key>
<array>
<string>/opt/homebrew/bin/aria2c</string>
<string>--enable-rpc=true</string>
<string>--rpc-secret=REPLACE_WITH_YOUR_SECRET_KEY</string>
<string>--rpc-allow-origin-all=true</string>
<string>--rpc-listen-all=true</string>
<string>--rpc-listen-port=6800</string>
</array>
<key>WorkingDirectory</key>
<string>/Users/REPLACE_WITH_YOUR_USER_NAME/Downloads/</string>
<key>StandardErrorPath</key>
<string>/usr/local/var/log/aria2.log</string>
<key>StandardOutPath</key>
<string>/usr/local/var/log/aria2.log</string>
</dict>
</plist>
Note:
- Update Your own Secret Key: REPLACE_WITH_YOUR_SECRET_KEY
- Update correct Path for working directory: /Users/REPLACE_WITH_YOUR_USER_NAME/Downloads/
- Save and close the file.
Now that you have created the service file, you can start and stop Aria2 as a service using the brew services
commands:
- To start Aria2 as a service, run:
brew services start aria2
- To stop Aria2 as a service, run:
brew services stop aria2
Update your REPLACE_WITH_YOUR_SECRET_KEY value in AriaNG Settings > RPC (localhost:6800)
By following this tutorial, you should now be able to start and stop Aria2 as a service using Homebrew on your Mac M1/M2 device. This will allow you to manage Aria2 more efficiently and ensure it runs smoothly on your Apple Silicon Mac.
Help: