Create notify
script:
sudo vi /usr/local/bin/notify
with content:
#!/usr/bin/osascript
on run argv
if length of argv = 1 then
display notification (item 1 of argv) with title "Notification" sound name "Glass"
else if length of argv > 1 then
display notification (item 1 of argv) with title (item 2 of argv) sound name "Glass"
else
return "<message> is required\nUsage: notify <message>[ <title>]"
end if
end run
Make it executable:
sudo chmod +x /usr/local/bin/notify
Now you can trigger mac os native notification from terminal:
# notification without title
notify "Test message"
# or with custom title
notify "Test message" "Test title"