# VS Code x Rubocop - ruby_executable_hooks: No such file or directory

### Environment

* macOS Monterey (Version 12.1)
    
* Ruby 2.6.6
    
* Ruby version manager: RVM
    
* Editor: VS Code
    

### To Reproduce:

I've installed `rubocop` gem in my app and add an extension `ruby-rubocop` in my VS Code.

Open VS Code and see the warning messages below. This caused Rubocop cannot execute correctly.

```ruby
/Users/lynnbright/.rvm/gems/ruby-2.6.6/bin/rubocop returns empty output! please check configuration.

env: ruby_executable_hooks: No such file or directory
```

### How to solve it:

1. Locate Rubocup:
    

```ruby
$ which rubocup
# /Users/lynnbright/.rvm/gems/ruby-2.6.6/bin/rubocop
```

2\. Replace `bin` with `wrappers`.

```plaintext
/Users/lynnbright/.rvm/gems/ruby-2.6.6/wrappers/rubocop
```

3\. Go to your VS Code `Settings` page. You can press `command` + `,`.

4\. Search `rubocup` or Find the tab `User > Extensions > Ruby-Rubocop > Ruby › Rubocop: Execute Path`.

5\. Paste Rubocop’s executable path:

```ruby
/Users/lynnbright/.rvm/gems/ruby-2.6.6/wrappers/
```

![](https://www.lynnbright.com/content/images/2022/01/---2022-01-27---10.51.53.png align="left")

6\. Restart your VS Code.

7\. The warning messages might disappear and your Rubocup can execute correctly now!

---

### Reference

* [https://stackoverflow.com/questions/26247926/how-to-solve-usr-bin-env-ruby-executable-hooks-no-such-file-or-directory](https://stackoverflow.com/questions/26247926/how-to-solve-usr-bin-env-ruby-executable-hooks-no-such-file-or-directory?ref=lynnbright.com)
