How to Easily Mirror an Entire Web Site Locally
It’s very easy to mirror an entire web site on your local machine thanks to the terminal command wget, here’s how to do it:
Launch the Terminal app and type the following command, replacing guimp.com (a tiny sample website) with the URL you desire to mirror locally.
wget -m http://www.guimp.com/
This will download the entire website on your local drive in a directory named the websites URL… note that this isn’t a particularly effective way to truly backup a website and it’s functionality, it’s simply mirroring it locally.
You can do this with just about any website, just fill in the appropriate site URL using the following syntax format:
wget -m [url]
Obviously this isn’t going to mirror ajax, databases, queries, dynamic content, or scripts, it’s only going to be a static HTML version of a site. To completely mirror a dynamic site locally, you would need access to the raw files through SFTP or otherwise, to which you could just download the entire site contents and then run in a mirrored version on a local machine through Apache, nginx, MAMP, or whatever other web server you’re prefer.
Note: various readers pointed out that wget is not installed in Mac OS X by default and that you’ll need to install it yourself. You can get wget for OS X by building it yourself from source (recommended for most), or install it through MacPorts. For the latter option, check out our past article on installing MacPorts. MacPorts is a very useful tool allowing you to easily install open source software packages and is highly recommended for moderate to advanced OS X users, or those interested in the command line.