How to upgrade bash to v4.0+ properly? I'm on OS X 10.10.2 and

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


How to upgrade bash to v4.0+ properly?

Update:

After installing bash with pkgsrc

 pkgin install bash


I got newer bash but it isn't default:

$ which bash
/bin/bash
$ /usr/pkg/bin/bash --version
GNU bash, version 4.3.30(1)-release (x86_64-apple-darwin13)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html&gt;

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14)
Copyright (C) 2007 Free Software Foundation, Inc.


How to make the newer bash the default one?
I reccomend getting Homebrew. Then run brew install bash, it will install bash 4.3.33. It's the easiest and safest way.

Then add the path to the executable to /etc/shells. For example: 

/usr/local/bin/bash