As an Irish Citizen, and therefore also an EU/EEA Citizen, you automatically have the right to live and work in any EEA country. Also although Switzerland is not technically part of the EEA the right to live and work is actually extended to Switzerland as well.
If you marry your Mexican boyfriend then he will have the same rights as you to live and work in any EEA country or Switzerland. But he will need an EEA Family Permit in his Mexican passport to prove he has that right. Assuming the two of you get married in Mexico he would apply for that EEA Family Permit at the embassy of the country in which the two of you plan to exercise that treaty right.
Under EU/EEA/Swiss regulations EEA Family Permits are issued free-of-charge.
If the two of you marry and plan to live in Ireland then you would not be exercising your treaty rights, but instead merely exercising your rights as an Irish citizen. Accordingly your husband (as he would be) would need to apply for a spouse visa from the Irish Embassy. There will be a charge for making that application.
how long should we be married beforehand
He would become an Family Member of an EEA Citizen as soon as the marriage happens. It might be a bit inconvenient to pop into the relevant embassy later the same day as the married happens, or even during the honeymoon, but seriously there is no minimum time the two of you need to be married before the EEA Family Permit, or as relevant, the Irish spouse visa, is applied for.