homebrew had created the following link:
Code:
[~]$ ls -l /usr/local/bin/ebook-viewer
lrwxr-xr-x 1 daniel admin 53 Dec 3 16:25 /usr/local/bin/ebook-viewer -> /Applications/calibre.app/Contents/MacOS/ebook-viewer
which is originally the one which gave the error.