I’m not sure I understand what the question is but I usually use StatsPlots.jl for histograms. There’s a bins keyword argument you can pass to histogram that will accept an integer or you can use one of the following auto-binning algorithms: :sturges, :sqrt, :rice, :scott or :fd. Here are some examples:
using Distributions
using StatsPlots
X = rand(Normal(), 100)
histogram(X, bins=5)

histogram(X, bins=10)

histogram(X, bins=:sturges)

Regarding the package not working after having installed Gadfly, I notice that you are working from the default environment (v1.2) pkg> so I would suggest setting up separate environments for each of your projects. For now, you might try to do pkg> rm Gadfly and then pkg> build Plots to remove Gadfly and then rebuild Plots to see if that helps.