I got this error too. Using Macos. It turned out this had to do with the ruby version in some way (I use rvm to manage the versions). This 'cannot load such file -- socket' message appeared when using ruby 2.4.2, but when I changed the used ruby version to 2.6.6, everything was installed just file.