Development Tips

Some usefull tricks for OSX People.

Change Default Shell, Use New Bash Which Is Installed From Homebrew

| Comments

Do to lack of Associative Arrays in Bash ( Version < 3 ) i decided to install bash from .

brew install bash

After installation, you must set your new bash as default bash in to your system. Homebrew installs bash to


If you wish to check your current bash version, just echo these variables:

echo $BASH_VERSION # gives full version
echo $BASH_VERSINFO # gives major version number

We will use chsh command to proceed but before that, we must add this new bash location in to /etc/shells . Otherwise, system will alert an error. Now, lets edit file:

sudo nano /etc/shells

add this line at the end of the list:


Now, we can run chsh command:

chsh -s /usr/local/bin/bash YOUR_USER_NAME

Enter your password to proceed. Now you can restart and check if the installation is correct:


Now you can define:

Associative Array Declaration requires BASH version 4 or higher
declare -A MY_ARRAY