user3995789
user3995789

Reputation: 3460

guard cannot find libnotify nor cannot disable notifications but throw errors

guard was running fine, until out of the blue, it throws me these bunch of errors:

$bin/guard
Could not open library 'libgtkmm-2.4': libgtkmm-2.4: cannot open shared object file: No such file or directory.
Could not open library 'libgtkmm-2.4.so': libgtkmm-2.4.so: cannot open shared object file: No such file or directory.
Could not open library 'libgtkmm-2.4.so.1': libgtkmm-2.4.so.1: cannot open shared object file: No such file or directory.
Could not open library 'libgtkmm-3.0': libgtkmm-3.0: cannot open shared object file: No such file or directory.
Could not open library 'libgtkmm-3.0.so': libgtkmm-3.0.so: cannot open shared object file: No such file or directory.
Could not open library 'libgtkmm-3.0.so.1': libgtkmm-3.0.so.1: cannot open shared object file: No such file or directory
13:15:58 - INFO - Guard is using Libnotify to send notifications.
13:15:58 - INFO - Guard is using TerminalTitle to send notifications.
13:15:59 - INFO - Bundle already up-to-date
13:15:59 - INFO - Guard::Rack will now restart your app on port 9292 using development environment.
13:15:59 - INFO - Restarting Rack...
libnotify.so not found!
13:15:59 - ERROR - Guard::Rack failed to achieve its <start>, exception was:
> [#4FE305F3B849] NoMethodError: undefined method `notify_init' for #<Libnotify::API:0x97a2d18>

Here is a guard notifiers command (shortened):

  +-------------------+-----------+------+-----------+-------------------+
  | libnotify         | ✔         | ✘    | transient | false             |
  |                   |           |      | append    | true              |
  |                   |           |      | timeout   | 3                 |
  +-------------------+-----------+------+-----------+-------------------+
  | notifysend        | ✘         | ✘    | t         | 3000              |
  |                   |           |      | h         | "int:transient:1" |
  +-------------------+-----------+------+-----------+-------------------+
  | terminal_title    | ✔         | ✘    |           |                   |
  +-------------------+-----------+------+-----------+-------------------+
  | file              | ✘         | ✘    | format    | "%s\n%s\n%s\n"    |
  +-------------------+-----------+------+-----------+-------------------+

I've tried setting notifiers :off option in the Guardfile, uninstalling libnotify gem, but it had no effect.

I am running ubuntu server so I think I shouldn't have libnotify, why is guard so rude to me all of a sudden?

Upvotes: 0

Views: 568

Answers (1)

Cezary Baginski
Cezary Baginski

Reputation: 2105

[EDIT2]

You mentioned you set notifiers :off, not notification :off (I get mixed with the options all the time, myself).

Also, guard 'detects' libnotify by requiring it here - which means you have the file somewhere on your system.

(If there's no file, requiring fails with a LoadError and Guard decides libnotify is unavailable).

One "brute force" way to find out where it is by running strace (should be available on server):

strace -f -e open bundle exec guard notifiers 2>&1 | /bin/grep -v 'ENOENT' |/bin/grep lib/libnotify.rb

which for me shows:

[pid 16703] open("/home/me/.rvm/gems/ruby-2.1.4@guard/gems/libnotify-0.9.0/lib/libnotify.rb", O_RDONLY|O_CLOEXEC) = 7
[pid 16703] open("/home/me/.rvm/gems/ruby-2.1.4@guard/gems/libnotify-0.9.0/lib/libnotify.rb", O_RDONLY|O_CLOEXEC) = 7

NOTE: you may have system rubies installed, which you can check with:

rvm use system
gem list libnotify

Guard is complaining simply because the gem is installed somewhere (or there's a vendored gem somewhere.

Upvotes: 1

Related Questions