DEV Community

Seiya Izumi
Seiya Izumi

Posted on

1

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
...

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)