<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jan </title>
    <description>The latest articles on DEV Community by Jan  (@jfpio).</description>
    <link>https://dev.to/jfpio</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3055394%2F4c0b0f4f-2af1-4060-8877-553af6a15a66.jpeg</url>
      <title>DEV Community: Jan </title>
      <link>https://dev.to/jfpio</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jfpio"/>
    <language>en</language>
    <item>
      <title>How to Get macOS Notifications for Long-Running Processes (Even over SSH!)</title>
      <dc:creator>Jan </dc:creator>
      <pubDate>Wed, 16 Apr 2025 12:22:37 +0000</pubDate>
      <link>https://dev.to/jfpio/how-to-get-macos-notifications-for-long-running-processes-even-over-ssh-154d</link>
      <guid>https://dev.to/jfpio/how-to-get-macos-notifications-for-long-running-processes-even-over-ssh-154d</guid>
      <description>&lt;p&gt;Edit: While this tutorial focuses on macOS with &lt;code&gt;terminal-notifier&lt;/code&gt;, Linux users can achieve a similar result by replacing it with &lt;code&gt;notify-send&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How many times have you run a long process on your Mac, constantly peeking at the terminal to see if it’s done?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sure, you can do:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;$'&lt;/span&gt;&lt;span class="se"&gt;\a&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;  &lt;span class="c"&gt;# beep!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;…but if you walk away or have your volume muted, that won’t help you. Wouldn’t it be nicer to get a real macOS notification that appears in your Notification Center? &lt;strong&gt;And guess what:&lt;/strong&gt; that works even when you’re running commands over SSH from a remote machine!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhqmpafaerzykjuc2wrva.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhqmpafaerzykjuc2wrva.png" alt="Image description" width="750" height="168"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This post shows you how, using the &lt;a href="https://github.com/julienXX/terminal-notifier" rel="noopener noreferrer"&gt;&lt;strong&gt;terminal-notifier&lt;/strong&gt;&lt;/a&gt; tool and a neat SSH trick.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Meet &lt;code&gt;terminal-notifier&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;terminal-notifier&lt;/code&gt; is a command-line utility that lets you create macOS notification banners from any script or terminal command. You can include messages, custom icons, sounds, and even open a URL when clicked.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew &lt;span class="nb"&gt;install &lt;/span&gt;terminal-notifier
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(If you don’t have Homebrew, install from &lt;a href="https://brew.sh" rel="noopener noreferrer"&gt;brew.sh&lt;/a&gt;)&lt;/p&gt;

&lt;h3&gt;
  
  
  Usage
&lt;/h3&gt;

&lt;p&gt;Once installed, try:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terminal-notifier &lt;span class="nt"&gt;-message&lt;/span&gt; &lt;span class="s2"&gt;"Build finished!"&lt;/span&gt; &lt;span class="nt"&gt;-sound&lt;/span&gt; Blow
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You’ll see a native macOS notification in the corner of your screen. &lt;strong&gt;No more missed beep!&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Using &lt;code&gt;terminal-notifier&lt;/code&gt; Locally
&lt;/h2&gt;

&lt;p&gt;If you’re on your Mac and running a long command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;my-long-command&lt;span class="p"&gt;;&lt;/span&gt; terminal-notifier &lt;span class="nt"&gt;-message&lt;/span&gt; &lt;span class="s2"&gt;"Command Done"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or if you want to notify on both success and failure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;my-long-command
&lt;span class="nv"&gt;EXIT_CODE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$?&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nv"&gt;$EXIT_CODE&lt;/span&gt; &lt;span class="nt"&gt;-eq&lt;/span&gt; 0 &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  &lt;/span&gt;terminal-notifier &lt;span class="nt"&gt;-message&lt;/span&gt; &lt;span class="s2"&gt;"✅ All good!"&lt;/span&gt;
&lt;span class="k"&gt;else
  &lt;/span&gt;terminal-notifier &lt;span class="nt"&gt;-message&lt;/span&gt; &lt;span class="s2"&gt;"❌ Failed with code &lt;/span&gt;&lt;span class="nv"&gt;$EXIT_CODE&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s easy enough. But what if your command runs on a &lt;strong&gt;remote&lt;/strong&gt; machine accessed via SSH?&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Getting Notifications from Remote Commands
&lt;/h2&gt;

&lt;p&gt;When you SSH into a remote server, that server can’t directly call &lt;code&gt;terminal-notifier&lt;/code&gt; on your Mac. The solution: &lt;strong&gt;send a message back to your Mac&lt;/strong&gt; (via SSH port forwarding) and let your local Mac run &lt;code&gt;terminal-notifier&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;One simple approach:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;On your Mac&lt;/strong&gt;: open a reverse SSH tunnel and listen with &lt;code&gt;netcat&lt;/code&gt; (&lt;code&gt;nc&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;On the remote&lt;/strong&gt;: send the message &lt;code&gt;"Beep"&lt;/code&gt; or &lt;code&gt;"OK"&lt;/code&gt; to the tunnel, which arrives at your Mac.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your Mac&lt;/strong&gt;: reads the message and triggers &lt;code&gt;terminal-notifier&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Example Script on Your Mac
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="nv"&gt;REMOTE_USER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"user"&lt;/span&gt;        &lt;span class="c"&gt;# your username on remote&lt;/span&gt;
&lt;span class="nv"&gt;REMOTE_HOST&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"remote"&lt;/span&gt;      &lt;span class="c"&gt;# remote host, e.g. myserver.com&lt;/span&gt;
&lt;span class="nv"&gt;LOCAL_PORT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;5050
&lt;span class="nv"&gt;REMOTE_PORT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;4000

&lt;span class="c"&gt;# 1) Create a reverse SSH tunnel, so remote:4000 =&amp;gt; mac:5050&lt;/span&gt;
ssh &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="nt"&gt;-N&lt;/span&gt; &lt;span class="nt"&gt;-R&lt;/span&gt; &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;REMOTE_PORT&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;:127.0.0.1:&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;LOCAL_PORT&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt; &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;REMOTE_USER&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;@&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;REMOTE_HOST&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;# 2) Listen on port 5050 locally&lt;/span&gt;
&lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do
  &lt;/span&gt;nc &lt;span class="nt"&gt;-l&lt;/span&gt; &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;LOCAL_PORT&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt; | &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;read &lt;/span&gt;line
    &lt;span class="c"&gt;# Trigger terminal-notifier when we get input&lt;/span&gt;
    terminal-notifier &lt;span class="nt"&gt;-message&lt;/span&gt; &lt;span class="s2"&gt;"Received from remote: &lt;/span&gt;&lt;span class="nv"&gt;$line&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-sound&lt;/span&gt; Blow
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ssh -f -N -R&lt;/code&gt;: opens a reverse tunnel but doesn’t start an interactive shell.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;nc -l ${LOCAL_PORT}&lt;/code&gt;: listens for connections on your Mac.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Remote Side
&lt;/h3&gt;

&lt;p&gt;On the remote server, once you’re inside an SSH session (or in &lt;code&gt;tmux&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s2"&gt;"OK&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | nc 127.0.0.1 4000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the text &lt;code&gt;OK&lt;/code&gt; is forwarded through the SSH tunnel to your Mac’s port 5050, your Mac sees it, and &lt;code&gt;terminal-notifier&lt;/code&gt; pops up!&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Quick Aliases
&lt;/h2&gt;

&lt;p&gt;If you want to make it even simpler:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remote server&lt;/strong&gt; (e.g., in your &lt;code&gt;~/.bashrc&lt;/code&gt; or &lt;code&gt;~/.zshrc&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create a quick notify alias for sending a beep message&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;notify&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'echo "Beep" | nc 127.0.0.1 4000 &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Local Mac&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Use terminal-notifier with a default message + sound&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;notify&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'terminal-notifier -message "Beep!" -sound Blow'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So any time you want to trigger the Mac notification:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;time-consuming-process&lt;span class="p"&gt;;&lt;/span&gt; notify
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python train.py&lt;span class="p"&gt;;&lt;/span&gt; notify
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  5. Wrap-Up
&lt;/h2&gt;

&lt;p&gt;Long-running tasks are no longer a “check every 5 minutes” chore. Let your Mac’s built-in notification system do the heavy lifting!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Install&lt;/strong&gt; &lt;code&gt;terminal-notifier&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set up&lt;/strong&gt; an SSH reverse tunnel&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use&lt;/strong&gt; &lt;code&gt;notify&lt;/code&gt; alias after long commands&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Done&lt;/strong&gt;: You’ll get a nice macOS banner when your remote job finishes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Happy building!&lt;/p&gt;

&lt;h3&gt;
  
  
  Credits
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/julienXX/terminal-notifier" rel="noopener noreferrer"&gt;terminal-notifier by @julienXX&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;ChatGPT!&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Additional Notes
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Advanced: Auto-run Your Local Listener Script via &lt;code&gt;LocalCommand&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Let’s say you &lt;strong&gt;want&lt;/strong&gt; the listener to automatically run every time you connect to a particular host, without manually starting the script. You can leverage an SSH config trick called &lt;code&gt;LocalCommand&lt;/code&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Edit &lt;code&gt;~/.ssh/config&lt;/code&gt; on your Mac&lt;/strong&gt; (or create if it doesn’t exist) and add something like:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="err"&gt;Host&lt;/span&gt; &lt;span class="err"&gt;myremote&lt;/span&gt;
  &lt;span class="err"&gt;HostName&lt;/span&gt; &lt;span class="err"&gt;remote.example.org&lt;/span&gt;
  &lt;span class="err"&gt;User&lt;/span&gt; &lt;span class="err"&gt;yourusername&lt;/span&gt;
  &lt;span class="err"&gt;RemoteForward&lt;/span&gt; &lt;span class="err"&gt;4000&lt;/span&gt; &lt;span class="err"&gt;127.0.0.1:5050&lt;/span&gt;
  &lt;span class="err"&gt;PermitLocalCommand&lt;/span&gt; &lt;span class="err"&gt;yes&lt;/span&gt;
  &lt;span class="err"&gt;LocalCommand&lt;/span&gt; &lt;span class="err"&gt;/Users/youruser/bin/notify_tunnel_listener.sh&lt;/span&gt; &lt;span class="err"&gt;&amp;amp;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;notify_tunnel_listener.sh&lt;/code&gt;&lt;/strong&gt; (on your Mac) can be:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="c"&gt;# If already running, do nothing:&lt;/span&gt;
pgrep &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="s2"&gt;"nc -l 5050"&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;exit &lt;/span&gt;0

&lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do
  &lt;/span&gt;nc &lt;span class="nt"&gt;-l&lt;/span&gt; 5050 | &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;read &lt;/span&gt;line
    terminal-notifier &lt;span class="nt"&gt;-message&lt;/span&gt; &lt;span class="s2"&gt;"Remote says: &lt;/span&gt;&lt;span class="nv"&gt;$line&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make it executable with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;chmod&lt;/span&gt; +x /Users/youruser/bin/notify_tunnel_listener.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Now, whenever you &lt;code&gt;ssh myremote&lt;/code&gt;, it sets up the reverse tunnel (&lt;code&gt;RemoteForward&lt;/code&gt;), &lt;em&gt;and&lt;/em&gt; runs your local listener script automatically (&lt;code&gt;LocalCommand&lt;/code&gt;). The &lt;code&gt;pgrep&lt;/code&gt; line prevents multiple listeners from stacking up.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  A Note on Foreground vs Background
&lt;/h4&gt;

&lt;p&gt;By default, &lt;code&gt;LocalCommand&lt;/code&gt; might block your SSH session if you run a &lt;code&gt;while true&lt;/code&gt; script. You can put an ampersand (&lt;code&gt;&amp;amp;&lt;/code&gt;) to run it in the background:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="err"&gt;LocalCommand&lt;/span&gt; &lt;span class="err"&gt;/Users/youruser/bin/notify_tunnel_listener.sh&lt;/span&gt; &lt;span class="err"&gt;&amp;amp;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You’ll need to handle stopping it yourself or let it run in the background indefinitely. One strategy is using the &lt;code&gt;pgrep&lt;/code&gt; check above.&lt;/p&gt;




&lt;h3&gt;
  
  
  Docker or Apptainer
&lt;/h3&gt;

&lt;p&gt;If you're running Docker or Apptainer &lt;strong&gt;inside&lt;/strong&gt; a remote machine, keep in mind that the container's localhost may not be the same as the host's localhost. Thus, &lt;code&gt;printf "OK\n" | nc 127.0.0.1 4000&lt;/code&gt; might fail. The simplest fix is to run your container with &lt;strong&gt;host networking&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Docker&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;--network&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;host ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Apptainer&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apptainer shell &lt;span class="nt"&gt;--net&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;host image.sif
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also ensure that &lt;code&gt;nc&lt;/code&gt; (netcat) is installed inside the container, because that's what actually sends the message back to the remote host. Once the container shares the host network and has &lt;code&gt;nc&lt;/code&gt; available, everything works just as described above.&lt;/p&gt;

</description>
      <category>mac</category>
      <category>tutorial</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
