If there's one task that's almost guaranteed to have you pulling your hair out at some point, it's printing. It doesn't matter what you're printing or where you're printing from, some way, somehow it'll drive you to behave like Basil Fawlty:

By comparison with actually using the thing, setting up a WiFi printer over a network should be a process of zen-like simplicity and calm. Thanks to OS X's inbuilt features like Bonjour and AirPrint, most network printers can at least be detected automatically.

If your printer happens to support AirPrint, you can add it and start printing to it straight away, without having to bother with drivers. If not, there’s a good chance that Apple has the drivers you need on its servers, so you can download them without having to hunt for them on the web.

How you set up your peinter depends on what type of printer you own. Broadly speaking there are three types of networked printers. The first is a dedicated printer attached to the network via an Ethernet cable. These are usually but not always laser printers found in corporate environments.

The second type is a Wi-Fi printer, such as an inkjet printer often found in a home although Wi-Fi printers are increasingly found in workplaces.

The third is a printer attached to a computer and shared, via either a Windows, Mac or Unix computer.

Luckily, whatever the case, Mac OS X makes it easy to connect to a shared printer. Having trouble connecting to your WiFi router? Read: What to do if your Mac isn't connecting to WiFi and the web.

Read next: Best printers for Mac, iPad and iPhone 2016 | How to print wirelessly from iPhone or iPad

How do I find the drivers for my printer

Before following any steps below, install drivers for the printer on your Mac as if you were connecting to it directly via USB. If you are lucky your Mac will detect the printer automatically, but if you need to download the driver yourself, you’ll have to visit the manufacturer’s website to find the drivers, (they might be identified as "CUPS"). Some driver installer software might attempt to detect a connected printer. Let it do so, even though it will fail, because this may be necessary to complete installation of the drivers.

Perhaps it goes without saying that any Wi-Fi printers should be already configured to connect to the same network as your Mac.

Read next: How to fix WiFi connection problems on Mac

How to add your WiFi printer

Before you can print, you need to make your printer available in the Print dialog box. To do that, go to System Preferences then Printers and Scanners, and click the ‘+’ at the bottom of the list of printers on the left hand side.

In most cases, you should keep the ‘Default’ tab selected. Your Mac will hunt for printers on the network to which its connected and display them in the window when it finds them. It should be able to find most modern wireless and wired network printers this way. When it’s found the one you want, click on it and look at the options at the bottom of the window. If the printer supports AirPint, that will be displayed opposite Use. If not, the name of the printer will be displayed.

If the printer supports AirPrint, and you want to use it, you can click Add now. If it doesn’t, or you want to use the printer’s own drivers, click the name of the printer. You should now see a message telling you that the drivers are on Apple’s servers and by clicking Add, you’ll download them. Click Add.

If Apple doesn’t have the drivers you need, you’ll need to open a web browser, navigate to the manufacturer’s website, find the drivers for your printer, and then download and install them, before returning to the Add Printer section of System Preferences.

Read next: Which Mac do I have: How to identify model, year and serial number and How to check your Mac's tech specs

Configure the printer

Once you’ve added a printer, you can set it as at the default by clicking on it in Printers and Scanners and selecting it from the Default Printer menu. You can also set its default paper size.

How to add a network printer

The process above can also be used to add a printer connected to your network by Ethernet. Your Mac should recognise it via Bonjour and allow you to add it from the Default tab of Printers and Scanners. If not, you’ll need to find its IP address (perhaps from your router’s admin page) or host name and add that in the IP tab.

If the printer you want to add doesn’t have a WiFi or Ethernet option, you can still make it available on the network. Plug it directly into a Mac on the network, or into a USB port on your router if it supports printers, then add it from Printers and Scanners.

Click on it in the Printers and Scanners sidebar, and check the box labelled ‘Share this printer on the network.’ Then click on Sharing Preferences to specify how and with whom you want to share it.

How to check your network or WiFi printer works

Just because the printer is added within System Preferences, don’t assume that it’s going to work! Print a test page by opening TextEdit, typing a few words, then clicking File > Print. Alternatively, some printer drivers come with their own testing and monitoring software that includes the ability to print a test page. To access the software, again open the Printers & Scanners component of System Preferences, select the new printer, then click the Options & Supplies button. Then click the Utility tab, and select Open Printer Utility.

(Original article by Keir Thomas)

Read next:

Install AirPrint on any printer to print from your iPad or iPhone

How to print from iPad or iPhone to any printer

Best apps for printing from iPhone or iPad

We also have this guide to fixing a problem when HP printers stop working.