今天在使用 brew services 命令重启某个应用的时候报错:

tony@TMBP ~ % brew services list
Error: undefined method `named' for #<OptionParser:0x00007ffe57a4c808>
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services/lib/services_cli.rb:67:in `run!'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services/cmd/services.rb:48:in `services'
/usr/local/Homebrew/Library/Homebrew/brew.rb:103:in `<main>'

查看了一下我本地的 ruby 和 gem 版本号:

tony@TMBP ~ % ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
tony@TMBP ~ % gem -v
3.0.3

网上搜了一圈,StackOverflow 里有个帖子说 update 一下就好了:

brew update -v

经测试有效。