Put into gemfile the following condition:
if RUBY_PLATFORM =~ /darwin/i
version = `uname -r` =~ /^(\d+)\./ && $1.to_i
gem 'terminal-notifier' if version >= 12
end
This should work. I know that in case of macos 10.4 the uname -r
was 8.x, and of macos 10.5 the uname -r
was 9.x.
Or with call to sw_vers
app:
if RUBY_PLATFORM =~ /darwin/i
version = `sw_vers -productVersion` =~ /^10\.(\d+)/ && $1.to_i
gem 'terminal-notifier' if version >= 9
end
In case when the gem is to be planned to run with jruby you have to use rbconfig
module.
if RbConfig::CONFIG['host_os'] =~ /darwin|mac os/i
version = `sw_vers -productVersion` =~ /^10\.(\d+)/ && $1.to_i
gem 'terminal-notifier' if version >= 9
end