imapsync on a mac takes too much ram

I’m currently migrating emails for one of our customers from the old hosting company to the new one. To do this we are using imapsync – an awesome tool!

TL;DR: Just use the docker box by Gilles…

https://hub.docker.com/r/gilleslamiral/imapsync

My own journey

But currently there is a weird bug on mac, that it might take a lot of memory up to the moment, that the process is killed. So I thought I “just” use a linux based docker box, which is not so easy at all.

One can start a box with the following command and mount the current working dir into /current – because I had my csv file and the loop script already here.

docker run -v .:/current -it --rm ubuntu /bin/bash

And then we need to install afew things to make imapsync compile

apt-get install libauthen-ntlm-perl libclass-load-perl libcrypt-ssleay-perl libdata-uniqid-perl libdigest-hmac-perl libdist-checkconflicts-perl libencode-imaputf7-perl libfile-copy-recursive-perl libfile-tail-perl libio-compress-perl libio-socket-inet6-perl libio-socket-ssl-perl libio-tee-perl libmail-imapclient-perl libmodule-scandeps-perl libnet-dbus-perl libnet-ssleay-perl libpar-packer-perl libreadonly-perl libregexp-common-perl libsys-meminfo-perl libterm-readkey-perl libtest-fatal-perl libtest-mock-guard-perl libtest-mockobject-perl libtest-pod-perl libtest-requires-perl libtest-simple-perl libunicode-string-perl liburi-perl libtest-nowarnings-perl libtest-deep-perl libtest-warn-perl make cpanminus git libssl-dev binutils as gcc-aarch64-linux-gnu

cpanm Crypt::OpenSSL::RSA Crypt::OpenSSL::Random --force
cpanm Mail::IMAPClient JSON::WebToken Test::MockObject
cpanm Unicode::String Data::Uniqid
cpanm CGI Crypt::OpenSSL::RSA  JSON::WebToken::Crypt::RSA 

cd /tmp/
git clone https://github.com/imapsync/imapsync.git
cd imapsync
mkdir -p dist
make install

# imapsync finally runs
imapsync

And while max killed the process after a couple of minutes, on Linux it just runs smoothly after 10mins:

$ docker stats
CONTAINER ID   NAME              MEM USAGE / LIMIT    MEM %     NET I/O       
c3bbc5ad8784   vibrant_hawking   272.2MiB / 7.81GiB   3.40%     816MB / 579MB 

Leave a Reply