Installing python using brew install fails.
$ brew install python
==> Installing dependencies for python: gdbm, openssl, readline, sqlite and xz
==> Installing python dependency: gdbm
==> Downloading https://homebrew.bintray.com/bottles/gdbm-1.18.1.high_sierra.bottle.tar.gz
Already downloaded: /Users/ramiscaray/Library/Caches/Homebrew/downloads/74ba9ab51669f49dc4dc585e1683648d26858c444e775c8f8b819932df55cf14--gdbm-1.18.1.high_sierra.bottle.tar.gz
Error: No such file or directory @ dir_chdir - /usr/local/Cellar
Warning: Bottle installation failed: building from source.
==> Downloading https://ftp.gnu.org/gnu/gdbm/gdbm-1.18.1.tar.gz
Already downloaded: /Users/ramiscaray/Library/Caches/Homebrew/downloads/c6e5196e3cea2a139cb849d508032f117c6351da5fe84323dc13ad2a0600264a--gdbm-1.18.1.tar.gz
Error: An exception occurred within a child process:
Errno::EPERM: Operation not permitted @ dir_s_mkdir - /usr/local/Cellar
Trying "brew update", "brew doctor" didn't resolve anything.
Solution:
Reinstall homebrew
Go to https://brew.sh/
Open terminal and rerun homebrew install
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Retry python homebrew install
$ brew install python