We have all faced this nightmare: a colleague, client, or online resource shares a Mega link packed with 5, 20, or 50 GB of assets.
The standard options are equally painful:
-
Downloading locally? It throttles your Internet bandwidth for hours, consumes local disk space, and any connection drop at 98% can force a restart from scratch.
-
Re-uploading to Google Drive? You have to push those same gigabytes back up with an upload speed that is typically much slower than your download speed.
-
Using Telegram bots or third-party web tools? A recipe for frustration: tiny file size caps (often under 2 GB), overloaded servers, endless queues, or broken scripts that cannot handle Mega's decryption keys.
-
Unofficial Python libraries (like
mega.py)? They often depend on outdated packages (like older versions oftenacity), causing dependency conflicts that break modern runtimes.
There is a clean, free, and robust workaround: let Mega’s servers talk directly to Google’s data centers.
By leveraging a Google Colab virtual machine alongside the official MEGAcmd CLI, files transfer directly between cloud infrastructures at sustained speeds between 50 and 100 MB/s, without using a single megabyte of your personal internet data plan.
Here is the complete step-by-step walkthrough.
How it works under the hood
Google Colab is a free Linux runtime environment provided by Google for cloud computing.
The pipeline is straightforward:
-
Google Colab serves as an ultra-fast intermediary machine hooked directly into Google's high-speed backbone network.
-
You mount your Google Drive storage as an accessible folder inside that virtual machine.
-
You run the official MEGAcmd Linux binary (maintained in C++ by Mega), which natively handles modern folder-level decryption.
Mega streams the payload to Colab, which writes it directly to your Drive. Your device acts merely as a remote control.
Navigating the Google Colab interface
Before running any commands, you only need to understand three interface elements:
-
The Cell: The rectangular block where code or shell instructions are placed.
-
The Play button
[ ▶ ]: The circular button with a triangle on the left side of each cell. Clicking it executes the instructions. While active, it switches to a loading spinner, then into a Stop button[ ■ ]. -
The
+ Codebutton: Located in the top-left toolbar. It inserts a fresh, empty cell right below the active one.
Step-by-step walkthrough
Step 1: Initialize the notebook
-
Go to colab.research.google.com while logged into your Google account.
-
Click "New notebook".
-
(Recommended) Click on the default title (
Untitled0.ipynb) in the top left and rename it toMegaToDrive.ipynb.- Why? Colab automatically backs up this file in a folder named Colab Notebooks inside your Google Drive. You will not need to recreate it next time—just open it directly.
Step 2: Mount your Google Drive
Paste the following code into the first cell visible on screen:
from google.colab import drive
drive.mount('/content/drive')-
Click the Play button
[ ▶ ]on the left of the cell. -
A Google authorization prompt will pop up: click "Connect to Google Drive", choose your account, and confirm permissions.
-
Within seconds, confirmation appears in the output:
Mounted at /content/driveStep 3: Install the official MEGAcmd client
Click the + Code button in the top toolbar to generate a second cell. Paste this snippet and execute it:
!wget -q [https://mega.nz/linux/repo/xUbuntu_22.04/amd64/megacmd-xUbuntu_22.04_amd64.deb](https://mega.nz/linux/repo/xUbuntu_22.04/amd64/megacmd-xUbuntu_22.04_amd64.deb)
!apt install -y ./megacmd-xUbuntu_22.04_amd64.deb-
Click the Play button
[ ▶ ]. -
This downloads the official Ubuntu package maintained by Mega and sets up the required system CLI utilities (
mega-get,mega-login,mega-cmd). -
Installation takes roughly 15 to 20 seconds. Once completed, a green checkmark will confirm execution.
Step 4: Stream the Mega link straight to Drive
Click + Code again to add a third cell, then paste:
!mkdir -p "/content/drive/MyDrive/MegaDownloads"
!mega-get "PASTE_YOUR_MEGA_LINK_HERE" "/content/drive/MyDrive/MegaDownloads"Keep these three key details in mind:
-
The Link: Replace
PASTE_YOUR_MEGA_LINK_HEREwith your actual Mega link (individual file or complete folder URLhttps://mega.nz/folder/...). -
Double Quotes
" ": Do not delete them. Mega URLs contain reserved characters (#,!,&) used as decryption keys. Without quotes, the Linux bash shell misinterprets them as shell operators. -
Destination Folder: You can swap
MegaDownloadsfor any folder name you prefer. Themkdir -pcommand creates it automatically if it does not already exist.
Click Play [ ▶ ]. The download starts immediately at datacenter speeds.
Why does the cell keep spinning at 100%?
During the download, the live progress indicator will output:
[Initiating MEGAcmd server in background. Log: /root/.megaCmd/megacmdserver.log]
Download finished: /content/drive/MyDrive/MegaDownloads/...
TRANSFERRING ||########################################||(355/355 MB: 100.00 %)Once the bar hits 100% and displays Download finished, the cell’s execution indicator might continue to spin indefinitely.
Why this happens:
-
mega-getboots a persistent background daemon (megacmdserver) that remains on standby for future command calls. -
The Colab virtual filesystem is flushing its write cache to the Google Drive API.
What to do:
As soon as you see 100.00 % and Download finished, click the Stop button [ ■ ] that replaced the Play icon. Your files are fully intact and synced on your Drive.
Two handy bonus commands
1. Inspect the downloaded files without leaving Colab
To verify the files arrived in your Drive without switching tabs, run:
!ls -lh "/content/drive/MyDrive/MegaDownloads"2. Extract a .zip file directly in the cloud
If you downloaded a large zip archive and want to avoid uncompressing it on your physical machine:
!unzip "/content/drive/MyDrive/MegaDownloads/Archive.zip" -d "/content/drive/MyDrive/MegaDownloads/ExtractedFolder"Reusing the notebook later
-
During the same working session:
If you have another link to pull down immediately, skip steps 2 and 3. Just replace the URL in the download cell and press Play.
-
Another day (fresh session):
Open Google Drive, navigate to
Colab Notebooks, and double-clickMegaToDrive.ipynb.Because ephemeral VMs reset after extended inactivity, simply hit Play on cells 1, 2, and 3 sequentially. Your pipeline is ready in under 45 seconds.

