36

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
  • 1
    I haven't found a workaround yet either, but I'm encountering the exact same issue :( Apparently, homebrew got rid of the switch command very recently: github.com/Homebrew/discussions/discussions/339 Feb 8, 2021 at 9:56
  • 10
    I am having this exact same problem. And this seems like a poor decision on Homebrew crews part to remove switch with no "hey use this instead" error..sigh.
    – thefonso
    Mar 8, 2021 at 4:01

3 Answers 3

29

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/[email protected]

If you're installing [email protected] for Ruby purposes, this thread tells you how to do that as well. For example:

CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])" RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])" rbenv install 2.7.2
1
  • this works for 2.7.2 but surprising not for 2.6.5
    – Vina
    Oct 28, 2022 at 3:10
0

Brew disabled "switch" command. Use "link" instead:

brew link [email protected]
-3

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.

2
  • 2
    your comment is not relevant because you use old version of brew Jun 21, 2022 at 15:04
  • NEVER do this, by doing sudo brew "you would be giving all build scripts full access to your system" (from documentation).
    – Karina D.
    Aug 17, 2022 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.