Note: It’s recommended that you use a Ruby version manager such as rvm or rbenv. But if using the system Ruby that comes pre-installed on MacOS, you should used sudo gem install wavefile. Otherwise you might run into a file permission error.