Bundle DelayedJob Ruby 1.9.2 Error

By Morten Møller Riis

October 21 2011 09:00 CET

Switching to Ruby 1.9.2-p290 I had the following error with delayed_job:

               Using delayed_job (3.0.0.pre2) from https://github.com/collectiveidea/delayed_job (at master)
               /Users/mmr/.rbenv/versions/1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1915:in `gsub': invalid byte sequence in US-ASCII (ArgumentError)
               [ ... ]
            	

The fix is easy. Try the following at your terminal:

               mmr@mmr-mbp ~ % locale
               LANG=
               LC_COLLATE="en_US.UTF-8"
               LC_CTYPE="en_US.UTF-8"
               LC_MESSAGES="en_US.UTF-8"
               LC_MONETARY="en_US.UTF-8"
               LC_NUMERIC="en_US.UTF-8"
               LC_TIME="en_US.UTF-8"
               LC_ALL=
               mmr@mmr-mbp ~ % 
            	

See that LANG constant? It is empty. Setting it will fix the problem. You can do this system wide on OSX/*nix by editing:

               # this should be /etc/zshenv if you are using ZSH.
               $ echo "export LANG=en_US.UTF-8" | sudo tee -a /etc/profile 
            	

Reload your terminal and run bundle again. It should work!