Last Updated: February 25, 2016
·
415
· paveldruzyak

Open latest screenshot in Preview.app

If you use capybara-screenshot gem maybe useful have possibility to quickly open latest screenshot from this tool. To do so, you should create next file:

bin/latest_screenshot

#!/bin/bash
file="$(ls tmp/capybara/*.png | tail -1)"
open $file -a /Applications/Preview.app

Add execution permission for this file:

chmod +x bin/latest_screenshot

And now you can easily open latest screenshot with next command:

bin/latest_screenshot