35217
MacOSX  
ver 10.12.1

Homebrewがおかしいことが発覚したので再インストールをするつもりでした。  
`brew update`が使えたのでHomebrewは入っているはずなのですが

```

    brew install ほにゃらら 
    
```

すると、下記のエラーが出ます。

```

    /usr/local/Homebrew/Library/Homebrew/PATH.rb:71:in `split': invalid byte sequence in UTF-8 (ArgumentError)
        from /usr/local/Homebrew/Library/Homebrew/PATH.rb:71:in `block in parse'
        from /usr/local/Homebrew/Library/Homebrew/PATH.rb:71:in `each'
        from /usr/local/Homebrew/Library/Homebrew/PATH.rb:71:in `flat_map'
        from /usr/local/Homebrew/Library/Homebrew/PATH.rb:71:in `parse'
        from /usr/local/Homebrew/Library/Homebrew/PATH.rb:8:in `initialize'
        from /usr/local/Homebrew/Library/Homebrew/utils.rb:310:in `new'
        from /usr/local/Homebrew/Library/Homebrew/utils.rb:310:in `which_all'
        from /usr/local/Homebrew/Library/Homebrew/gpg.rb:5:in `find_gpg'
        from /usr/local/Homebrew/Library/Homebrew/gpg.rb:20:in `gpg2'
        from /usr/local/Homebrew/Library/Homebrew/gpg.rb:23:in `<class:Gpg>'
        from /usr/local/Homebrew/Library/Homebrew/gpg.rb:3:in `<top (required)>'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/Homebrew/Library/Homebrew/requirements/gpg2_requirement.rb:2:in `<top (required)>'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/Homebrew/Library/Homebrew/requirements.rb:3:in `<top (required)>'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/Homebrew/Library/Homebrew/dependency_collector.rb:5:in `<top (required)>'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/Homebrew/Library/Homebrew/software_spec.rb:7:in `<top (required)>'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/Homebrew/Library/Homebrew/formula.rb:10:in `<top (required)>'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/Homebrew/Library/Homebrew/readall.rb:1:in `<top (required)>'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/Homebrew/Library/Homebrew/tap.rb:2:in `<top (required)>'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/Homebrew/Library/Homebrew/compat/tap.rb:1:in `<top (required)>'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/Homebrew/Library/Homebrew/compat.rb:2:in `<top (required)>'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/Homebrew/Library/Homebrew/global.rb:56:in `<top (required)>'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/Homebrew/Library/Homebrew/brew.rb:14:in `<main>'
    
```

ターミナルでrubyコマンドを打ってもずっと反応がないです。確実におかしいのですがどこで異常を確認できますか？  
brewコマンドは`brew update`以外doctorも含めて上記のエラーがでます。

この投稿はマルチポストです。  
<https://teratail.com/questions/78714>

よろしくお願いします。
CC BY-SA 3.0
2017-06-02T03:20:01.367
35209
2017-06-02T07:42:15.330
2017-06-02T07:36:17.857
19110
23515
question
macos homebrew
brew install すると invalid byte sequence in UTF-8 エラーが出る
エラーの内容が

```

    PATH.rb:71:in `split': invalid byte sequence in UTF-8 (ArgumentError)
    
```

なので、変数 `PATH` の中に UTF-8 として正しくないバイト列が紛れ込んでいるようです。  
新しいターミナルで `echo ${PATH}` を実行してその **出力** を見て、中身に変な文字が含まれていないか確認してください。

変な文字が含まれていれば、その部分を `PATH` に追加している設定ファイルが存在するはずなので、そのファイルを探して修正してください。  
具体的には、MacOS で bash を使っている場合だとたとえば以下のファイルが怪しいです。

```

    /etc/profile
    ~/.bash_profile
    ~/.bash_login   (.bash_profile が無い場合)
    ~/.profile      (.bash_login が無い場合)
    ~/.bashrc
    /etc/paths
    /etc/paths.d
    
```

* * *

  * 関連する投稿 
    * [Homebrew and ruby error with UTF-8 and 'split'](https://stackoverflow.com/q/24482265/5989200) \-- Stack Overflow
    * [Where does $PATH get set in OS X 10.6 Snow Leopard?](https://superuser.com/q/69130/680903) \-- SuperUser
    * [PATH設定がどこにあるか分からないときに見るべきファイル](http://qiita.com/gm_kou/items/24dec9f0e51b9343651b) \-- Qiita
CC BY-SA 3.0
2017-06-02T07:25:25.227
35217
2017-06-02T07:42:15.330
2017-06-02T07:42:15.330
76
19110
35209
answer