How to Install Megatools, the Cloud Storage CLI on Ubuntu, the popular cloud storage service known for its security feature where all files are end-to-end encrypted locally before they are uploaded.

This prevents anyone, even employees of Mega Limited from accessing the files without knowledge of the pass key used for encryption. service was previously noted for a large 50 GB storage allocation for free accounts and up to 8 TB is available for paid accounts.

Megatools is a set of command line utilities that allow you to interact with your account directly from the command line. You can directly download using the cli on your Ubuntu machine. They are a great set of tools, however, installing them does get confusing for a new Linux user.

This guide will show you how to install it and set it up in no time.

Below is a list of all the tools you will be installing on your console and the function they perform:

 megareg      Register and verify a new mega account
 megadf       Show your cloud storage space usage/quota
 megals       List all remote files
 megamkdir    Create remote directory
 megarm       Remove remote file or directory
 megaput      Upload individual files
 megaget      Download individual files
 megadl       Download file from a public Mega link (does not require login)
 megastream   Streaming download of a file (can be used to preview videos or music)
 megacopy     Upload or download a directory tree
 megafs       Mount remote filesystem locally.

What you need:

  • SSH or terminal access to an Ubuntu server.
  • An internet connection (duh).

Installing from Package Repository:

Installing megatools package on Ubuntu is as easy as running the following command on terminal. The command basically makes sure that you have the latest version of all packages from Ubuntu’s apt package service and then you can just install the megatools

sudo apt-get update
sudo apt-get install megatools

After this has been installed you can make sure it’w working successfully by running the following command:

megadl '!IK9KLpRS8J1h82Kpa0kWJ4343kPwDh!2adB'

Installing from source:

Now we will go ahead and install the meghatools from source. This means we will be installing all the tools needed to compile and build the packages from source. First, you need to find out what’s the latest version of megatools available. To find out the latest version, simply visit any one of the links below and see what’s the latest version number:

At the time of writing this article the latest version was 1.9.98. If it is different in your case, simply replace 1.9.98 with your version in all the commands below.

Open your Ubuntu terminal (or SSH to it) and type in the following commands one after the other.

sudo apt-get update

Run this command to download the package lists from the repositories and “update” them to get information on the newest versions of packages and their dependencies.

sudo apt-get install libtool libglib2.0-dev gobject-introspection libgmp3-dev nettle-dev asciidoc glib-networking openssl libcurl4-openssl-dev libssl-dev

This installs all the dependencies that you may need to compile megatools from source.


wget is used to download the latest megatools. Replace 1.9.98 with the latest version is available.

zcat megatools-1.9.98.tar.gz > megatools-1.9.98.tar
tar -xf megatools-1.9.98.tar

Use zcat to decompress the downloaded file and tar -xf to extract the contents to a folder.

cd megatools-1.9.98/
sudo make install

Finally, run the above commands to compile megatools and install it in your system.

If all went well, you should now have megatools installed on your system.

Just like in the installation from the apt-get package repo, to download from a link, simply type megadl '' and the download will start.

megadl '!IK9KLpRS8J1h82Kpa0kWJ4343kPwDh!2adB'

For syntax of other commands, type

man megatools

That’s it. You’re done, you have successfully installed megatools on your Ubuntu box.