Uncommon homebrew error: "Unknown command: switch"

Viewed 38034

I am in the process of trying to restart some legacy project that demands the use of an older version of openssl.

I have found good input on the issue here, which worked on one of my machines but not the other, which gives me the following error:

$  brew switch openssl 1.0.2t
Error: Unknown command: switch

The error does not seem to be very common, nothing helpful is showing up on a google/stackoverflow search.

What I have tried so far:

  • resolved all warnings shown by brew doctor
  • run brew update && brew upgrade
  • updated Xcode Command Line Tools
  • reinstalled openssl

What can I do to fix this?

2 Answers

As I commented above, Homebrew got rid of the switch command entirely, which is why it says "Unknown command".

But rbenv provides a tap that you can install openssl from. You can run the command below:

brew install rbenv/tap/openssl@1.0

If you're installing openssl@1.0 for Ruby purposes, this thread tells you how to do that as well. For example:

CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.0)" RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.0)" rbenv install 2.7.2

I just used sudo:

sudo brew switch dart 2.16.0

and close the vs code and start again. That's it and run without any errors.

Related