If you try open source very often, you must be encountering some Makefile doesn’t have uninstall target, so what do you do if you must install all the files in order to get the program to load its resources files properly? Keep output and manually delete one by one by hand afterwards?

Now with Unco, you can record and undo things from a command’s doing. File copying, removing, creating, mode changing, etc. Unco will reverse the effects.

Here is a example, first step is to record:

$ unco record make PREFIX=$HOME/.local install
test -d /home/livibetter/.local || mkdir -p /home/livibetter/.local
test -d /home/livibetter/.local/bin || mkdir -p /home/livibetter/.local/bin
test -d /home/livibetter/.local/share/man/man6 || mkdir -p /home/livibetter/.local/share/man/man6
install -m 0755 pipes.sh /home/livibetter/.local/bin
install -m 0644 doc/pipes.sh.6 /home/livibetter/.local/share/man/man6

Then you could check the history:

$ unco history
index    command (*=undone)
     1   make PREFIX=/home/livibetter/.local install

If anything needs to be undone, then:

$ unco undo 1
unco:successfully undid the recorded changes

$ unco history
index    command (*=undone)
     1 * make PREFIX=/home/livibetter/.local install

If you find it shouldn’t be undone, you can redo it:

$ unco redo 1
unco:successfully redid the recorded changes

The logs are stored under ~/.unco by the record numbers.

Undo is written by Kazuho Oku under the MIT License. Currently in very early stage of development, but I have faith in this project and intend to use it, because I don’t want to hand-type to remove all the stuff a Makefile does to filesystem.