Use the following:

```ruby
if system("which phantomjs").present?
```