Using Devver on OS X 10.6 “Snow Leopard”
If you’re trying to use Devver and you see this error:
/Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/em/connection.rb:302:in `start_tls': undefined method `set_tls_parms' for EventMachine:Module (NoMethodError) from /Library/Ruby/Gems/1.8/gems/devver-2.4.1/lib/client/mod_client.rb:32:in `post_init' from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/em/connection.rb:43:in `new' from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/em/connection.rb:36:in `instance_eval' from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/em/connection.rb:36:in `new' from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:716:in `bind_connect' from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:723:in `connect' from /Library/Ruby/Gems/1.8/gems/devver-2.4.1/lib/client/client.rb:125:in `push_tests' from /Library/Ruby/Gems/1.8/gems/devver-2.4.1/bin/devver:145 from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:in `call' from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:1503:in `event_callback' from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:342:in `run_timers' from (eval):44:in `each' from (eval):44:in `each' from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:339:in `run_timers' from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:322:in `run' from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in `loop' from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:318:in `run' from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/pr_eventmachine.rb:64:in `run_machine' from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:in `run' from /Library/Ruby/Gems/1.8/gems/devver-2.4.1/bin/devver:144 from /usr/bin/devver:19:in `load' from /usr/bin/devver:19
… it’s because EventMachine (and other compiled gems) may act a little funky after installing Apple’s latest OS.
In this post, I’ll go through some steps that should help you resolve this error (… assuming you use MacPorts. If you don’t, please tailor these directions accordingly). But first:
- Warning: The directions below may leave your system in an unknown state. Please, please, please backup everything before going further. Time Machine is your friend!
- Disclaimer: These steps worked for me, but I can’t guarantee they’ll work for you. If you have any problems, please let me know in the comments or email firstname.lastname@example.org.
- Note: If you already installed Devver before upgrading to Snow Leopard, things will likely continue to work fine for you for now – but these directions may be helpful when you upgrade Devver clients.
OK, now that we’ve got that out of the way …
1. Upgrade MacPorts
Try running something like
port list installed
. If you get an error like this:
dlopen(/opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib, 10): no suitable image found. Did find: /opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib: no matching architecture in universal wrapper while executing "load /opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib" ("package ifneeded Pextlib 1.0" script) invoked from within "package require Pextlib 1.0" (file "/opt/local/bin/port" line 40)
You need to install the latest version of MacPorts. Go here and download the ‘Snow Leopard’ dmg and install.
2. Reinstall openssl and ruby
Now that MacPorts is installed, do this:
sudo port sync sudo port upgrade openssl sudo port upgrade ruby
You could also try
sudo port upgrade ruby186
if you want Ruby 1.8.6, but I haven’t tried this myself.
3. Reinstall EventMachine
sudo gem uninstall eventmachine sudo gem install eventmachine
And you’re done!
Now you should be able to run Devver normally. If that didn’t work, please let me know!
Bonus: Reinstall other gems
Matt Aimonetti has written a handy script (Update: here is my fork, with a new gem path an an important bug fix on line eight) that will find the gems you should reinstall once you’ve done the above steps. The only change you’ll need to make is to replace the gem path:
#Dir.glob('/Library/Ruby/Gems/**/*.bundle').map do |path| Dir.glob('/opt/local/lib/ruby/gems/**/*.bundle').map do |path|
For more info, you can find a great guide on resolving Ruby-related problems when upgrading to Snow Leopard at rubyonrails.org