GarageBand is Apple's application for creating, editing, and having fun with music on a Mac. This free download from the Mac App Store works well with MIDI instruments. If you don't have a MIDI keyboard, you can turn your Mac keyboard into a GarageBand piano.
Connect a MIDI Keyboard or Controller to Garageband on a Mac
You might not think of your Mac keyboard as a music machine, but it can be. Here's how:
Open GarageBand by double-clicking it in the Applications folder or by selecting its icon in the Dock.
Select New Project in the GarageBand sidebar.