We just released Maid v0.6.0, which is full of new features:
Daemon mode, “watch”, and “repeat” support (thanks Jurriaan Pruis!)
Maid tasks for Rake (thanks Pedro Lambert!)
Safari download detection (thanks Jayson Rhynas!)
Copy (thanks Nico Ritschel!)
Image dimensions detection (thanks for the inspiration Coby Chapple!)
Official Ruby 2.2.0 support
As you can see, the Maid community has a lot to do with Maid’s continued development. Thank you everyone for your contributions!
Maid remains a popular open source project. (Check out others on my GitHub.) It was downloaded by users over 7000 times and starred over 300 times just in 2014, for a total of 16684 downloads and 1045 stars. Our community of users sharing rules now has 42 examples for you to consider when scripting your own Maid.
Let’s look at a few of the ways Maid helps you with its new features.
In the past, Maid has been run manually or via cron. Maid v0.6.0 introduces support for watching your filesystem for changes and taking action immediately. (Under the hood, this is implemented with the listen gem, which uses fsevent on OSX and inotify on Linux.)
Starting Maid automatically at login is pretty straitforward on my daily driver (Ubuntu) — see the README for details. It isn’t quite as easy on OSX — a situation I expect will improve — but in the meantime, check out Jurriaan’s great post on running Maid as a Daemon on OS X.
This new “watch” feature opens up all sorts of possibilities. Since Maid can now act automatically, you can even treat folders as drop targets for your Maid rules.
# Drop files in this directory and watch the duplicates disappear...
watch '~/Desktop/De-dupe' do
rule 'trash dupes' do
# Sift through a large collection of downloads by categorizing them as "image", "video", "text", etc.
watch '~/Downloads' do
rule 'categorize by media type' do
files('~/Downloads/*').each do |path|
# As your photos show up in your Dropbox, Maid will organize them for you!
watch '~/Dropbox/Camera Uploads' do
rule 'organize new photos by date' do
where_content_type(files('~/Dropbox/Camera Uploads/*'), 'image').each do |path|
iso8601 = modified_at(path).to_date.iso8601.sub('-', '/')
We still support manual invocation and cron, but you should try watch — you’ll like it.
Another handy addition is the ability to read the dimensions of images. Here’s an example:
# Keep your background pictures organized by their dimensions
watch '~/Pictures/Wallpaper' do
rule 'organize wallpaper by dimensions' do
where_content_type(dir('~/Pictures/Wallpaper/*'), 'image').each do |image|
width, height = dimensions_px(image)
And since it’s Ruby, you can define your own logic, such as categorizing images as big/small or portrait/landscape.
Once you know Maid, you might miss the methods it provides in your other Ruby projects, so Maid is now available as a Rake task as well. As an example, look no further than Maid’s own Rakefile:
# Clean up Rubinius-compilied Ruby
# Get rid of generated files
All Maid tools are available to you in Rake tasks, so you can do any common file manipulations you need.
That’s all for now. I hope Maid can help you keep your computer tidy in 2015!
After the OS X 10.9 release, I got some energy to release Maid v0.4.0, mostly because it finally made it possible to drop Ruby 1.8.7 compatibility while still letting casual Ruby users on OS X use Maid. Needless to say, I’m happy OS X 10.9 has Ruby 2.0 included. I had honestly gotten stuck on Ruby 1.8.7 compatibility, since so many gems have been dropping support. It is officially end-of-life, after all.
In case you missed it, here’s some details from the ChangeLog:
I’ve released a beta of Maid v0.3.0. It contains a bugfix which required an additional DSL method to be added. The move method now only moves to pre-existing directories, and the new rename method should be used if renaming is the intention. This makes it easier to detect accidental overwrites.
From my observations, most of the time users who share their rules are using move with directories, so it should be a pretty painless upgrade… but since there’s a new method in the DSL, this new version is called v0.3.0 instead of v0.2.3. (A new version v0.4.0 is in the works — it was once referred to as v0.3.0 — so don’t let that confuse you. :) )
gem install maid --pre
I’m interested in whether anyone runs into issues with the change I described. Otherwise, it should be pretty much the same as v0.2.2. Please leave a comment in this issue with your experiences!