运行以下命令行后,我正尝试在MacOS 10.10.5上安装自制程序:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

我经历了所有的安装过程,但最后得到了这个错误:
-e:234:in `split': invalid byte sequence in UTF-8 (ArgumentError)
from -e:234:in `<main>'

之后我甚至不能运行brew doctorbrew update,因为我得到以下错误:
/usr/local/Library/Homebrew/global.rb:48:in `split': invalid byte sequence in UTF-8 (ArgumentError)
from /usr/local/Library/Homebrew/global.rb:48:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/brew.rb:15:in `<main>'

我做错了什么?怎么解决?

最佳答案

我通过将以下内容添加到主目录中的.bashrc文件中修复了此问题:

#   Set Paths
#   ------------------------------------------------------------
    export PATH="$PATH:/usr/local/bin/"
    export PATH="/usr/local/git/bin:/sw/bin/:/usr/local/bin:/usr/local/:/usr/local/sbin:/usr/local/mysql/bin:$PATH"

我在this article on customizing your bash profile中找到了这个代码。在本文中,作者将这一行添加到.bash_配置文件中,但在.bashrc文件中,这一行似乎更适合我。
在Mac上,您可以在Finder中显示这些文件,以便编辑,方法是进入Finder中的主目录,然后按三个键Command + Shift + .

10-08 04:39