You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Mac High Sierra下如何修复OpenSSL::Digest::DSS未初始化常量问题?

Fixing "uninitialized constant OpenSSL::Digest::DSS" Error with Net::SSH/Net::SFTP on Mac High Sierra

Hey everyone, I just fought through a frustrating issue on my Mac High Sierra and wanted to pass along what I learned to save you some time.

I was working with Ruby gems that rely on Net::SSH, and specifically the Net::SFTP gem was failing to connect to any server. The error that kept stopping me was:

uninitialized constant OpenSSL::Digest::DSS

First thing I tried was the go-to gem update: bundle update net-ssh. I figured a newer version might patch whatever was broken, but no luck — the error persisted.

After poking around a bit, I realized this wasn't just a gem version problem. The root cause was that my Ruby installation wasn't properly linked with the system's OpenSSL library.

Here's what fixed it for me (I use rbenv, adjust these steps if you're on rvm):

  • First, confirm your OpenSSL path with which openssl — I used Homebrew's version, so mine pointed to /usr/local/bin/openssl.
  • Reinstall your Ruby version with explicit OpenSSL linking. For rbenv, run:
    RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl)" rbenv install [your-ruby-version]
    
  • Set this freshly installed Ruby as your global or local default:
    rbenv global [your-ruby-version]
    # Or for a project-specific setup:
    rbenv local [your-ruby-version]
    
  • Rebundle your dependencies with bundle install and test Net::SFTP again.

This fixed the OpenSSL misalignment and got Net::SFTP connecting to servers without that annoying DSS constant error.

内容的提问来源于stack exchange,提问作者danielricecodes

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 10:05:15