OpenSSL / libcrypto.dylib Problem with Package Control in Sublime Text 3
Asked Answered
L

3

5

Package Control is not loading in Sublime Text 3 running on MacOS, Catalina 10.15.6.

None of the Package Control commands are shown in the Command Palette.

I have checked that Package Control was not in ignored_packages, have manually reinstalled Package Control (multiple times), and even uninstalled and reinstalled Sublime Text 3.

When I start Sublime Text 3 the error below is shown in the console when it tries to load Package Control. It looks like the problem relates in some way to OpenSSL, specifically to the libcrypto.dylib file.

I recently updated/upgraded my system using Homebrew and suspect that something occurred during the update that has caused the problem.

reloading plugin Package Control.Package Control
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 125, in reload_plugin
    m = importlib.import_module(modulename)
  File "./python3.3/importlib/__init__.py", line 90, in import_module
  File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 1199, in load_module
    exec(compile(source, source_path, 'exec'), mod.__dict__)
  File "/Users/bader/Library/Application Support/Sublime Text 3/Installed Packages/Package Control.sublime-package/Package Control.py", line 89, in <module>
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 1199, in load_module
    exec(compile(source, source_path, 'exec'), mod.__dict__)
  File "/Users/bader/Library/Application Support/Sublime Text 3/Installed Packages/Package Control.sublime-package/package_control/commands/__init__.py", line 3, in <module>
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 1199, in load_module
    exec(compile(source, source_path, 'exec'), mod.__dict__)
  File "/Users/bader/Library/Application Support/Sublime Text 3/Installed Packages/Package Control.sublime-package/package_control/commands/advanced_install_package_command.py", line 10, in <module>
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 1199, in load_module
    exec(compile(source, source_path, 'exec'), mod.__dict__)
  File "/Users/bader/Library/Application Support/Sublime Text 3/Installed Packages/Package Control.sublime-package/package_control/package_manager.py", line 34, in <module>
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 1199, in load_module
    exec(compile(source, source_path, 'exec'), mod.__dict__)
  File "/Users/bader/Library/Application Support/Sublime Text 3/Installed Packages/Package Control.sublime-package/package_control/downloaders/__init__.py", line 20, in <module>
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 1199, in load_module
    exec(compile(source, source_path, 'exec'), mod.__dict__)
  File "/Users/bader/Library/Application Support/Sublime Text 3/Installed Packages/Package Control.sublime-package/package_control/downloaders/oscrypto_downloader.py", line 44, in <module>
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 1199, in load_module
    exec(compile(source, source_path, 'exec'), mod.__dict__)
  File "/Users/bader/Library/Application Support/Sublime Text 3/Installed Packages/Package Control.sublime-package/package_control/deps/oscrypto/tls.py", line 11, in <module>
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 1199, in load_module
    exec(compile(source, source_path, 'exec'), mod.__dict__)
  File "/Users/bader/Library/Application Support/Sublime Text 3/Installed Packages/Package Control.sublime-package/package_control/deps/oscrypto/_mac/tls.py", line 39, in <module>
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 1199, in load_module
    exec(compile(source, source_path, 'exec'), mod.__dict__)
  File "/Users/bader/Library/Application Support/Sublime Text 3/Installed Packages/Package Control.sublime-package/package_control/deps/oscrypto/_mac/util.py", line 208, in <module>
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 1199, in load_module
    exec(compile(source, source_path, 'exec'), mod.__dict__)
  File "/Users/bader/Library/Application Support/Sublime Text 3/Installed Packages/Package Control.sublime-package/package_control/deps/oscrypto/_openssl/_libcrypto.py", line 15, in <module>
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 1199, in load_module
    exec(compile(source, source_path, 'exec'), mod.__dict__)
  File "/Users/bader/Library/Application Support/Sublime Text 3/Installed Packages/Package Control.sublime-package/package_control/deps/oscrypto/_openssl/_libcrypto_ctypes.py", line 30, in <module>
  File "./python3.3/ctypes/__init__.py", line 353, in __init__
OSError: dlopen(/usr/local/lib/libcrypto.dylib, 6): no suitable image found.  Did find:
    /usr/local/lib/libcrypto.dylib: mach-o, but wrong architecture
    /usr/local/lib/libcrypto.dylib: mach-o, but wrong architecture
Luna answered 8/12, 2020 at 15:58 Comment(3)
If you're in a real hurry, check out the Sublime Text #support channel on Discord. Will Bond, the creator of Package Control, is actually there right now. He or somebody else should be able to help you out. It does look like an issue with your Homebrew upgrade, though - is there any way you can downgrade/reinstall openssl, which owns libcrypto, or check to make sure it didn't accidentally install the files for Apple Silicon instead of x86_64?Alcina
More likely, it installed 32-bit files instead of 64-bit, or vice-versa. Try removing (you might need to --force it) and reinstalling openssl - that may do the trick. Or, you can just use MacPorts :PAlcina
You could also ask in the Technical Support forum on Sublime HQ, you can add @wbond to alert Will Bond but others may be able to help too. If you find the solution elsewhere please take the time to write it up and add it as an answer on this page — in case you don't know it is fine to answer your own question.Pirri
L
3

@MattDMo, you were correct that it was a 32-bit versus 64-bit problem AND that Will Bond would help. After posting a ticket on Package Control, @wbond responded right away suggesting that I move the file /usr/local/lib/libcrypto.dylib.

For the sake of completeness, @wbond asked for the output of the terminal command:

file /usr/local/lib/libcrypto.dylib

That returned

/usr/local/lib/libcrypto.dylib: Mach-O dynamically linked shared library i386

And he wrote:

Hmm, I don't think there is a 32bit version of macOS 11. I'd move that file and restart Sublime Text.

He was correct and it worked.

Luna answered 9/12, 2020 at 19:56 Comment(1)
Just wanna add that a similar problem can occur if you custom-compiled openssl at some point, which can be fixed the same way. I had installed something that compiled openssl on its own and it created a /usr/local/lib/libcrypto.3.dylib, pointed to by a symlink /usr/local/lib/libcrypto.dylib. The regular /usr/lib/libcrypto.dylib symlink points to a .35.dylib file, but Package Control was using the .3 version, which is too different and doesn't contain some of the things it expects.Rora
N
8

A lot of Homebrew packages require openssl and this can cause the problem you're seeing.

I fixed it by unlinking openssl: brew unlink openssl and restarting Sublime Text.

Nedra answered 5/7, 2023 at 10:52 Comment(0)
L
3

@MattDMo, you were correct that it was a 32-bit versus 64-bit problem AND that Will Bond would help. After posting a ticket on Package Control, @wbond responded right away suggesting that I move the file /usr/local/lib/libcrypto.dylib.

For the sake of completeness, @wbond asked for the output of the terminal command:

file /usr/local/lib/libcrypto.dylib

That returned

/usr/local/lib/libcrypto.dylib: Mach-O dynamically linked shared library i386

And he wrote:

Hmm, I don't think there is a 32bit version of macOS 11. I'd move that file and restart Sublime Text.

He was correct and it worked.

Luna answered 9/12, 2020 at 19:56 Comment(1)
Just wanna add that a similar problem can occur if you custom-compiled openssl at some point, which can be fixed the same way. I had installed something that compiled openssl on its own and it created a /usr/local/lib/libcrypto.3.dylib, pointed to by a symlink /usr/local/lib/libcrypto.dylib. The regular /usr/lib/libcrypto.dylib symlink points to a .35.dylib file, but Package Control was using the .3 version, which is too different and doesn't contain some of the things it expects.Rora
C
1

This problem is related to upgrading to OpenSSL 3. It's an unsafe idea to downgrade or unlink OpenSSL.

Package control 4 fixes this problem and you can install the beta using the instructions at the bottom of this thread: https://github.com/wbond/package_control/issues/1612#issuecomment-1636034709

Chiclayo answered 25/9, 2023 at 13:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.