Terminal opens with "chruby: command not found" lines every time I open. How to remove them?

After deleting XCode, my Terminal window always opens with these lines:


-bash: /usr/local/opt/chruby/share/chruby/chruby.sh: No such file or directory
-bash: /usr/local/opt/chruby/share/chruby/auto.sh: No such file or directory
-bash: chruby: command not found


I actually have two sets of those lines: one probably from when I deleted XCode in the past (and on my old Macbook Pro), and the second from just now when I deleted XCode from my current Mac Mini. How do I remove these 6 lines from my terminal window? Is there some obscure file deep in the system I need to remove, or something?

Mac mini, macOS 14.7

Posted on Jun 24, 2025 08:27 PM

Reply
Question marked as Top-ranking reply

Posted on Jun 25, 2025 05:59 AM

The Ruby environment tool (chruby) is installed by homebrew package manager, not Xcode, or the Command Line Tools for Xcode.


This is why your Bash shell is spewing this information in your Terminal. Use homebrew to uninstall chruby and clean up those entries in your Bash dot file(s).


Additional to the Ruby (2.6.10p210) installed by the operating system, I also keep a current (e.g. 3.4.4) version of Ruby under management by the asdf multiple runtime manager.

5 replies
Question marked as Top-ranking reply

Jun 25, 2025 05:59 AM in response to mr_magoo_87

The Ruby environment tool (chruby) is installed by homebrew package manager, not Xcode, or the Command Line Tools for Xcode.


This is why your Bash shell is spewing this information in your Terminal. Use homebrew to uninstall chruby and clean up those entries in your Bash dot file(s).


Additional to the Ruby (2.6.10p210) installed by the operating system, I also keep a current (e.g. 3.4.4) version of Ruby under management by the asdf multiple runtime manager.

Jun 25, 2025 08:42 AM in response to mr_magoo_87

Check that your Bash dot {.bashrc, .bash_profile, .bash_profile, .profile, .bash_login} files do not have a path reference to files that no longer exist. Also, look in your Terminal settings > profiles > Shell panel to ensure there is no reference to directly run chruby there either.


Note: On Intel platforms, homebrew will install packages into /usr/local and with Apple Silicon, into /opt/homebrew.

Jun 25, 2025 10:12 AM in response to VikingOSX

Aha, I think I found it. .bash_profile had the following that I deleted:


source /usr/local/opt/chruby/share/chruby/chruby.sh
source /usr/local/opt/chruby/share/chruby/auto.sh
chruby ruby-3.1.3
source /usr/local/opt/chruby/share/chruby/chruby.sh
source /usr/local/opt/chruby/share/chruby/auto.sh
chruby ruby-3.1.3


Removing those lines from the file fixed the terminal. I'll check the other ones to make sure there aren't any references, but I think this annoyance is fixed. Thank you!


By the way - I noticed I have a Homebrew folder in /usr/local still. I know Homebrew saves to opt/homebrew on Apple Silicon, but can I delete the folder in /usr/local, or is it likely some packages still need files from there? My Mac Mini is Apple Silicon, I assume migration just moved the folder over when I moved data from my Intel Macbook Pro.

Jun 25, 2025 08:35 AM in response to VikingOSX

Huh, I thought I had uninstalled chruby, but it looks like I hadn't. I had already deleted the chruby folder from the opt/homebrew/opt path in the past, and I assumed that's why I was getting those "no such file or directory" messages.


Anyway, I uninstalled chruby, double-checked the homebrew/opt folder you listed (as well as the path in the messages I'm getting in Terminal) and confirmed I don't have a chruby folder or those .bash files in there, but I'm still getting those messages after restarting Terminal. Are there other files/folders I could check for that might be tripping this up?

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Terminal opens with "chruby: command not found" lines every time I open. How to remove them?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.