To do pull-ups properly, (bar to chest) you need about 18” of headroom above the pull-up bar. To just get your chin above the bar 12” would be enough. This is a little more than you strictly need but, you don’t want the top of your head to touch the ceiling at the top of a pull-up.