SelfControl is a free Mac app that helps you avoid distracting websites. Block your own access to websites or mail servers for a pre-set length of time.
Overall, I love the app! and it's been quite helpful in breaking my habit of randomly browsing to YouTube; nevertheless, I wish it had a schedule feature.
PS: I normally start it a day ahead to ensure that I do not access YouTube in the morning.