Homebrew refusing to link OpenSSL

前端 未结 15 2438
南旧
南旧 2020-11-22 03:51

I\'m on: OSX 10.11.6, Homebrew version 0.9.9m OpenSSL 0.9.8zg 14 July 2015

I\'m trying to play with with dotnetcore and by following their instructions,

I\'

相关标签:
15条回答
  • 2020-11-22 04:21

    If migrating your mac breaks homebrew:

    I migrated my mac, and it unlinked all my homebrew installs - including OpenSSL. This broke gem install, which is how I first noticed the problem and started trying to repair this.

    After a million solutions (when migrating to OSX Sierra - 10.12.5), the solution ended up being comically simple:

    brew reinstall ruby
    brew reinstall openssl
    
    0 讨论(0)
  • 2020-11-22 04:23

    As the update to the other answer suggests, the workaround of installing the old openssl101 brew will no longer work. For a right-now workaround, see this comment on dotnet/cli#3964.

    The most relevant part of the issue copied here:

    I looked into the other option that was suggested for setting the rpath on the library. I think the following is a better solution that will only effect this specific library.

    sudo install_name_tool -add_rpath /usr/local/opt/openssl/lib /usr/local/share/dotnet/shared/Microsoft.NETCore.App/1.0.0/System.Security.Cryptography.Native.dylib

    and/or if you have NETCore 1.0.1 installed perform the same command for 1.0.1 as well:

    sudo install_name_tool -add_rpath /usr/local/opt/openssl/lib /usr/local/share/dotnet/shared/Microsoft.NETCore.App/1.0.1/System.Security.Cryptography.Native.dylib

    In effect, rather than telling the operating system to always use the homebrew version of SSL and potentially causing something to break, we're telling dotnet how to find the correct library.

    Also importantly, it looks like Microsoft are aware of the issue and and have both a) a somewhat immediate plan to mitigate as well as b) a long-term solution (probaby bundling OpenSSL with dotnet).

    Another thing to note: /usr/local/opt/openssl/lib is where the brew is linked by default:

    13:22 $ ls -l /usr/local/opt/openssl
    lrwxr-xr-x  1 ben  admin  26 May 15 14:22 /usr/local/opt/openssl -> ../Cellar/openssl/1.0.2h_1
    

    If for whatever reason you install the brew and link it in a different location, then that path is the one you should use as an rpath.

    Once you've update the rpath of the System.Security.Cryptography.Native.dylib libray, you'll need to restart your interactive session (i.e., close your console and start another one).

    0 讨论(0)
  • 2020-11-22 04:23

    None of these solutions worked for me on OS X El Capitan 10.11.6. Probably because OS X has a native version of openssl that it believes is superior, and as such, does not like tampering.

    So, I took the high road and started fresh...


    Manually install and symlink

    cd /usr/local/src  
    
    • If you're getting "No such file or directory", make it:

      cd /usr/local && mkdir src && cd src

    Download openssl:

    curl --remote-name https://www.openssl.org/source/openssl-1.0.2h.tar.gz
    

    Extract and cd in:

    tar -xzvf openssl-1.0.2h.tar.gz
    cd openssl-1.0.2h
    

    Compile and install:

    ./configure darwin64-x86_64-cc --prefix=/usr/local/openssl-1.0.2h shared
    make depend
    make
    make install
    

    Now symlink OS X's openssl to your new and updated openssl:

    ln -s /usr/local/openssl-1.0.2h/bin/openssl /usr/local/bin/openssl
    

    Close terminal, open a new session, and verify OS X is using your new openssl:

    openssl version -a
    
    0 讨论(0)
  • 2020-11-22 04:23
    export https_proxy=http://127.0.0.1:1087 http_proxy=http://127.0.0.1:1087 all_proxy=socks5://127.0.0.1:1080
    

    works for me

    and I think it can solve all the problems like Failed to connect to raw.githubusercontent.com port 443: Connection refused

    0 讨论(0)
  • 2020-11-22 04:25

    I have a similar case. I need to install openssl via brew and then use pip to install mitmproxy. I get the same complaint from brew link --force. Following is the solution I reached: (without force link by brew)

    LDFLAGS=-L/usr/local/opt/openssl/lib 
    CPPFLAGS=-I/usr/local/opt/openssl/include
    PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig 
    pip install mitmproxy
    

    This does not address the question straightforwardly. I leave the one-liner in case anyone uses pip and requires the openssl lib.

    Note: the /usr/local/opt/openssl/lib paths are obtained by brew info openssl

    0 讨论(0)
  • 2020-11-22 04:27

    Just execute brew info openssland read the information where it says:

    If you need to have this software first in your PATH run: echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

    0 讨论(0)
提交回复
热议问题