How to use bash "autocd" option in Mac

izumisy

Seiya Izumi

Posted on April 8, 2020

How to use bash "autocd" option in Mac

Run this command to check the version of Bash installed in your Mac.

$ /bin/bash --version  
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14)    
Copyright (C) 2007 Free Software Foundation, Inc.  

If it is not 4.0 and more, you should install the newer one with homebrew

$ brew update
$ brew install bash

Make sure where the new Bash has been installed into and if it has been updated or not. Finally, use echo and write the path of it into /etc/shells

$ which bash
...
$ /usr/local/bin/bash --version
...
$ echo /usr/local/bin/bash | sudo tee -a /etc/shells
...

Last but not the last, use chsh command to change the current shell, and check the result of shopt -p sure has autocd

$ chsh -s /usr/local/bin/bash
...
$ shopt -p
...
💖 💪 🙅 🚩
izumisy
Seiya Izumi

Posted on April 8, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related