Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using Mountain Lion. I've installed Ruby first with RVM, then with rbenv. I can assure it's running the latest one with which ruby, it correctly points to the one installed with rbenv.

gem won't install any gem, it always throws me the same error (not always in the same file, but the same error with split:

Users/Macbook/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:1357:in `split': invalid byte sequence in UTF-8 (ArgumentError)
    from /Users/Macbook/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:1357:in `find_executable0'
    from /Users/Macbook/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:1564:in `pkg_config'
    from extconf.rb:15:in `<main>'

I've tried setting these exports in my .profile, without luck:

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

I've also updated bash with brew, and activated it with chsh. iTerm2 is correctly configurated with UTF-8 encoding too.

I have no idea what else to do now. I have XCode 4.6.3.

share|improve this question
Did you try using rbenv instead of rvm? I 've also had some issues using rvm but none so far using rbenv – jmoreira Oct 15 '13 at 12:48
Yes, same results. – Cristian Oct 16 '13 at 13:30

2 Answers 2

up vote 0 down vote accepted

The problem was solved cleaning up all files related with the setting up of the PATHenvironment variable (.bash_profile, .profile, .bashrc) and then installing rvmagain. Executing an echo $PATHrevealed a strange character which broke bundler's processing of the PATH.

share|improve this answer

I have 64 bit Cygwin, Ruby 2.0.0 and gem 2.4.1 and was experiencing the same issue. gem install ..., gem update, everything ended with "ERROR: While executing gem ... (ArgumentError) invalid byte sequence in UTF-8".

I had also all locales set to "en_US.UTF-8".

I have read somewhere that it should help to set LANG to an empty string or "C.BINARY", but it didn't help. But it was good hint to start experimenting.

Finally I have solved that by setting both LANG and LC_ALL to an empty string. All other locale environment variables (LC_CTYPE etc.) was automatically set to "C.UTF-8" by that, LANG and LC_ALL remained empty.

Now gem is finally working.

I guess, that you had the same reason. When you have "cleaned" your dotfiles, your probably changed values of your locales.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.