I recently upgraded to macOS Catalina (10.15 public beta). There are several “under the hood” changes to the Unix underpinnings which may trip people up. I’m comfortable at the command line but by no means an expert so this post is mainly designed as a reference for future me.
You’ll probably notice the first change when you launch Terminal. If your default shell is set to Bash you will receive the following warning every time:
The default interactive shell is now zsh. To update your account to use zsh, please run `chsh -s /bin/zsh`. For more details, please visit [https://support.apple.com/kb/HT208050](https://support.apple.com/kb/HT208050).
FWIW, I think this is an excellent warning message… it states the “problem”, provides instructions on how to fix it and links to a much more detailed article with more information (including how to suppress the warning if you want to use the ancient version of Bash that’s bundled with macOS for some reason).
Personally, I took the opportunity of changing shells to switch to fish shell again. I used it on my last computer but hadn’t bothered to set it up again on this one. It’s a lot less similar to Bash than Zsh but most of the time that’s a good thing (Bash can be quite cryptic and inconsistent). On those occasions where a tool or StackOverflow post doesn’t have fish instructions (and I can’t figure out the fish equivalent myself) it’s usually a simple matter of running
bin/zsh now) to temporarily switch to a supported shell.
The next change you might notice is when you go to use a Ruby executable (e.g.
irb). The first time I ran it I received this warning:
WARNING: This version of ruby is included in macOS for compatibility with legacy software. In future versions of macOS the ruby runtime will not be available by default, and may require you to install an additional package.
I was a little surprised by this one, not that Ruby was being deprecated (that got a fair bit of coverage in the nerd circles I move in), but because I knew I had installed rbenv, and the latest version of Ruby through that, prior to upgrading to Catalina.
Thankfully the excellent rbenv README had a section on how rbenv works with the
PATH and the shims rbenv needs at the start of your
PATH for it to work properly.
After changing shells (to Zsh or fish), there’s a good chance that whatever technique you previously used to modify your
PATH when your shell session starts is no longer in effect in your new shell.
The README says to run
rbenv shell to fix it, however on my machine (regardless of shell) I kept getting a warning that it’s unsupported and to run
rbenv init for instructions. You should probably do the same (in case the instructions get updated) but at the time of writing the instructions
rbenv init gave for various shells are:
# fish: > rbenv init # Load rbenv automatically by appending # the following to ~/.config/fish/config.fish: status --is-interactive; and source (rbenv init -|psub) # Zsh: % rbenv init # Load rbenv automatically by appending # the following to ~/.zshrc: eval "$(rbenv init -)" # Bash: $ rbenv init # Load rbenv automatically by appending # the following to ~/.bash_profile: eval "$(rbenv init -)"
Once you restart your terminal window you should be able to confirm that rbenv is handling ruby versions (via its shims) for you:
> which ruby /Users/matthew/.rbenv/shims/ruby > ruby -v ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-darwin18]