0

Is it safe to switch to the homebrew ruby version system-wide? Won't it break anything?

The brew version is 3.0.3; the system version is 2.6.8p205.

E.g., by adding the following lines to .zshrc:

export PATH="/opt/homebrew/opt/ruby/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/ruby/lib"
export CPPFLAGS="-I/opt/homebrew/opt/ruby/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/ruby/lib/pkgconfig"

1 Answer 1

1

This only affects processes launched from your environment and not the system at-large.

homebrew is designed to install on a one-person computer with a user with admin rights. However, when installed, '/usr/local/bin' (on Intel machines) or '/opt/homebrew' on M1 Silicon ones) house the installed software. Since the permissions of these directories and contents, are world-readable/executable, a process can choose either the "local" version or the standard one via an absolute link to the executable or through a PATH search.

homebrew will also install Xcode Command Line Tools if it isn't already installed.

A more complete overview can be found here.

3
  • What about XCode?
    – Yurij
    Commented Jan 22, 2022 at 14:45
  • Are there any built-in CLI utils that rely on ruby that I should be aware of?
    – Yurij
    Commented Jan 22, 2022 at 14:45
  • 1
    @Yurij Run file {/usr,}/{s,}bin/* | grep ruby to find out :-) And actually, even if there are some, they probably have #!/usr/bin/ruby in the first line so they would pick the "right" version.
    – nohillside
    Commented Jan 22, 2022 at 16:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .