У меня проблема: пока в терминале выполняются долгие задачи, я перехожу на сафари, забывая о работе. Раньше я использовал || echo -e "\a", но он не работает, пока мои подключенные наушники лежат на столе.

Теперь я нахожу лучшее решение. С osascript вы можете отправлять уведомления mac os с терминала:

Вы можете настроить текст, заголовок, субтитры и звук. Вот пример кода:

osascript -e 'display notification "task execution completed" with title "terminal" sound name "Ping.aiff"'

Звук можно выбрать из ~/Library/Sounds или /System/Library/Sounds.

И несколько псевдонимов, которые я использую:

# type it after long time command: `... && notify`
alias notify="osascript -e 'display notification \"task execution completed\" with title \"terminal\" sound name \"Ping.aiff\"'"
# install pods with notification 
alias pi="pod install && osascript -e 'display notification \"cocoapods installed\" with title \"terminal\" sound name \"Ping.aiff\"'"
# install pods with updating repo and notification
alias piu="pod install --repo-update && osascript -e 'display notification \"cocoapods installed\" with title \"terminal\" sound name \"Ping.aiff\"'"
# update git and pods with notification
alias good_morning="git checkout develop && git pull -r && piu"