It is said Yahoo finance closed the historical data API on May 18th 2017, but we can still download the data from the webpage. Here shows the way to download data using python request.
Recently when installing some gems, it popped out errors that telling the Ruby version is lower than required... I have to upgrade the shipped Ruby, version 2.0.0p648 (2015-12-16 revision 53162), on my machine. There are a few methods dealing with this, but I found the easiest way is using Homebrew.