Cannot pair Playstation 3 controller to iMac firstly, apologies if this has been asked before, however I have read tons of online guides and had no luck solving this issue.
I bought a Playstation 3 controller with the intention of using it to play games on my Mac and my bootcamped Windows machines (I do not own a Playstation 3 console). Eager to start playing my games from a whole new perspective, I searched the web for instructions on how to connect the gamepad to the Mac computer via USB and Bluetooth.
As I said, I've read a dozen different guides and watched a few videos explaining how this could be achieved. They always list the same set of instructions:  


Plug in via USB, controller should show up on list of Bluetooth
devices.  
Press PS button and remove the USB cable; lights on    controller
should blink faster and Mac should ask for a passcode.
Enter passcode, add device to favourites, done.


However, I can't seem to get past that second step, where I am supposed to press the button and remove the USB cable. First of all, the lights blink slowly as the computer is charging the controller. Pressing the PS button doesn't make them blink faster, as when the device is looking to pair via Bluetooth. Also, when I remove the USB cable, the lights stop blinking altogether.
To expand on what happens step by step, the controller first shows up as 'Not connected', as expected. When I press the PS button, it switches to 'Connected' and the lights blink faster. After a few seconds, the lights stop blinking and eventually the controller switches back to 'Not connected'.
If I click on 'Pair' while the controller is 'Connected', it will either say 'Pairing failed' or 'Couldn't connect to this device' (I'm not really sure when each of these appear, but either way it just means I've been unsuccessful in trying to connect the device). I've never got a pop-up asking for a passcode.
My computer is a mid-2011 iMac 21.5" running OSX El Capitan 10.11.3 Beta. I've had some luck connecting my controller to my Windows 10 machine, however only through USB (I don't think I tried Bluetooth) and of course with the aid of Motioninjoy.
I'm thinking if I can't get this gamepad to work then I might replace it with either an Xbox 360 one (which seems to be the most compatible with PC/Mac games) or a Playstation 4 one (which I'd assume is more compatible with the newest OSX).
I would very much appreciate any help. Thanks in advance.
Are you're suggesting that you bought the controller used? If that is the case, are you sure that the battery isn't shot? Try leaving the USB cable plugged in and let the controller charge for a while. From my experience, if the battery is charged then pressing the PS button should at least blink something.

I have owned a PS3 only for the last year and rarely use it, but I have noticed that it only seems to charge when plugged into a PS3 as it doesn't seem to do much when plugged into an outlet that has USB charging ports on it (never tried an independent USB charging adapter).

If your battery is toast, I think you can find replacements on Amazon for several dollars. Documentation on the internet seems to indicate that replacing the PS3 controller battery is trivial for someone with basic electronics repair skills.