{"id":3010,"date":"2026-05-09T11:47:41","date_gmt":"2026-05-09T15:47:41","guid":{"rendered":"https:\/\/csimmons.dev\/blog\/?p=3010"},"modified":"2026-05-09T11:48:03","modified_gmt":"2026-05-09T15:48:03","slug":"add-items-like-mailpit-or-tailing-logs-to-the-commandbox-tray","status":"publish","type":"post","link":"https:\/\/csimmons.dev\/blog\/2026\/05\/add-items-like-mailpit-or-tailing-logs-to-the-commandbox-tray\/","title":{"rendered":"Add items (like Mailpit or tailing logs) to the CommandBox Tray"},"content":{"rendered":"<p>I&#8217;ve always been a fan of the tray that&#8217;s available when CommandBox launches. On the Mac, it appears as a menu bar icon in the top menu (first icon below).<\/p>\n<figure id=\"attachment_3011\" aria-describedby=\"caption-attachment-3011\" style=\"width: 284px\" class=\"wp-caption alignnone\"><img width=\"294\" height=\"29\" data-public-id=\"commandbox-menu-bar-icon_30118dfdc\/commandbox-menu-bar-icon_30118dfdc.png\" loading=\"lazy\" decoding=\"async\" class=\"wp-post-3010 wp-image-3011 size-full\" src=\"https:\/\/res.cloudinary.com\/ccsimmons\/images\/w_294,h_29,c_scale\/f_auto,q_auto\/v1778341545\/commandbox-menu-bar-icon_30118dfdc\/commandbox-menu-bar-icon_30118dfdc.png?_i=AA\" alt=\"CommandBox menu bar icon\" data-format=\"png\" data-transformations=\"f_auto,q_auto\" data-version=\"1778341545\" data-seo=\"1\" \/><figcaption id=\"caption-attachment-3011\" class=\"wp-caption-text\">CommandBox menu bar icon<\/figcaption><\/figure>\n<p>It has some very convenient built-in options:<\/p>\n<pre><code class=\"text\">Servername\n\u251c\u2500\u2500 Stop Server\n\u251c\u2500\u2500 Restart Server\n\u251c\u2500\u2500 Open...\n\u2502   \u251c\u2500\u2500 Webroot\n\u2502   \u251c\u2500\u2500 Server Home\n\u2502   \u251c\u2500\u2500 Site Home\n\u2502   \u2514\u2500\u2500 Server Admin\n\u251c\u2500\u2500 Info\n\u2502   \u251c\u2500\u2500 Engine: adobe 2023.0.17+330864\n\u2502   \u251c\u2500\u2500 Webroot: \/Path\/to\/website\/\n\u2502   \u251c\u2500\u2500 URL: https:\/\/127.0.0.1:8443\n\u2502   \u251c\u2500\u2500 PID: 99999\n\u2502   \u2514\u2500\u2500 Heap: Not set<\/code><\/pre>\n<p>I frequently need to access\u00a0<a href=\"https:\/\/mailpit.axllent.org\/\" target=\"_blank\" rel=\"noopener\">Mailpit<\/a>\u00a0and various log files as I work through the development process on a current project. This got me wondering if I could add some of my own frequently accessed items to the tray. It turns out you can add quite a few different things.<\/p>\n<h2 id=\"enable-the-tray\">Enable the tray<\/h2>\n<p>First, enable the tray in the\u00a0<code>server.json<\/code>\u00a0file for the site.<\/p>\n<pre><code>\"trayEnable\": true,<\/code><\/pre>\n<p>Next, let&#8217;s start simple and add a single item to open\u00a0<a href=\"https:\/\/mailpit.axllent.org\/\" target=\"_blank\" rel=\"noopener\">Mailpit<\/a>\u00a0in a browser. The\u00a0<code>trayOptions<\/code>\u00a0setting accepts an array of objects. Each object should contain a label, an action, and one of\u00a0<code>[url, path, command]<\/code>. The label is the text that appears in the tray. The action tells CommandBox what to perform (<code>openbrowser<\/code>,\u00a0<code>openfilesystem<\/code>,\u00a0<code>runAsync<\/code>, etc.). The\u00a0<code>[url, path, command]<\/code>\u00a0values provide the URL of the site, the filesystem path, or the command to execute, respectively.<\/p>\n<h2 id=\"setting-the-tray-options\">Setting the tray options<\/h2>\n<pre><code class=\"json\">\"trayOptions\": [\n    {\n        \"label\": \"Mailpit Web Interface\",\n        \"action\": \"openbrowser\",\n        \"url\": \"http:\/\/localhost:8025\"\n    }\n]<\/code><\/pre>\n<p>Let&#8217;s dive a little deeper with some other options.<\/p>\n<p>Add a \u201cdivider\u201d of blank space between CommandBox&#8217;s built-in options and the ones we are adding.<\/p>\n<pre><code class=\"json\">{\n    \"label\": \" \",\n    \"disabled\": true\n}<\/code><\/pre>\n<p>Open a folder on the filesystem.<\/p>\n<pre><code class=\"json\">{\n    \"label\": \"Open Log Folder\",\n    \"action\": \"openfilesystem\",\n    \"path\": \"${serverinfo.serverHomeDirectory}\/WEB-INF\/cfusion\/logs\"\n}<\/code><\/pre>\n<p>Tail the last 100 lines of\u00a0<code>mailsent.log<\/code>\u00a0(<strong>macOS only as written, but adaptable for Linux or Windows<\/strong>).<\/p>\n<pre><code class=\"json\">{\n    \"label\": \"Tail mailsent.log\",\n    \"action\": \"runAsync\",\n    \"command\": \"tmpfile=$(mktemp -t tail-mailsent).command; printf '#!\/bin\/zsh\\nprintf \\\"\\\\e]0;Tail mailsent.log\\\\a\\\"\\nclear\\ntail -n 100 -f \\\"%s\\\"\\n' '${serverinfo.serverHomeDirectory}\/WEB-INF\/cfusion\/logs\/mailsent.log' &gt; \\\"$tmpfile\\\"; chmod +x \\\"$tmpfile\\\"; open -a Terminal \\\"$tmpfile\\\"\"\n}<\/code><\/pre>\n<p><a href=\"#explanation-of-the-tail-command\">Explanation of the tail command<\/a><\/p>\n<p>Add some icons using emojis.<\/p>\n<pre><code class=\"text\">\ud83d\udee0 Development Tools\n\ud83d\udcec Mailpit Web Interface\n\ud83d\udcc2 Logs<\/code><\/pre>\n<h2 id=\"putting-it-all-together\">Putting it all together<\/h2>\n<figure id=\"attachment_3012\" aria-describedby=\"caption-attachment-3012\" style=\"width: 684px\" class=\"wp-caption alignnone\"><img width=\"694\" height=\"289\" data-public-id=\"commandbox-tray-open_3012cde4e\/commandbox-tray-open_3012cde4e.png\" loading=\"lazy\" decoding=\"async\" class=\"wp-post-3010 wp-image-3012 size-full\" src=\"https:\/\/res.cloudinary.com\/ccsimmons\/images\/w_694,h_289,c_scale\/f_auto,q_auto\/v1778341596\/commandbox-tray-open_3012cde4e\/commandbox-tray-open_3012cde4e.png?_i=AA\" alt=\"CommandBox tray open\" data-format=\"png\" data-transformations=\"f_auto,q_auto\" data-version=\"1778341596\" data-seo=\"1\" srcset=\"https:\/\/res.cloudinary.com\/ccsimmons\/images\/f_auto,q_auto\/v1778341596\/commandbox-tray-open_3012cde4e\/commandbox-tray-open_3012cde4e.png?_i=AA 694w, https:\/\/res.cloudinary.com\/ccsimmons\/images\/w_300,h_125,c_scale\/f_auto,q_auto\/v1778341596\/commandbox-tray-open_3012cde4e\/commandbox-tray-open_3012cde4e.png?_i=AA 300w\" sizes=\"auto, (max-width: 694px) 100vw, 694px\" \/><figcaption id=\"caption-attachment-3012\" class=\"wp-caption-text\">CommandBox tray open<\/figcaption><\/figure>\n<pre><code class=\"json\">\"trayEnable\": true,\n\"trayOptions\": [\n    {\n        \"label\": \" \",\n        \"disabled\": true\n    },\n    {\n        \"label\": \"\ud83d\udee0 Development Tools\",\n        \"items\": [\n            {\n                \"label\": \"\ud83d\udcec Mailpit Web Interface\",\n                \"action\": \"openbrowser\",\n                \"url\": \"http:\/\/localhost:8025\"\n            },\n            {\n                \"label\": \"\ud83d\udcc2 Logs\",\n                \"items\": [\n                    {\n                        \"label\": \"Open Log Folder\",\n                        \"action\": \"openfilesystem\",\n                        \"path\": \"${serverinfo.serverHomeDirectory}\/WEB-INF\/cfusion\/logs\"\n                    },\n                    {\n                        \"label\": \"Tail application.log\",\n                        \"action\": \"runAsync\",\n                        \"command\": \"tmpfile=$(mktemp -t tail-application).command; printf '#!\/bin\/zsh\\nclear\\ntail -n 100 -f \\\"%s\\\"\\n' '${serverinfo.serverHomeDirectory}\/WEB-INF\/cfusion\/logs\/application.log' &gt; \\\"$tmpfile\\\"; chmod +x \\\"$tmpfile\\\"; open -a Terminal \\\"$tmpfile\\\"\"\n                    },\n                    {\n                        \"label\": \"Tail exception.log\",\n                        \"action\": \"runAsync\",\n                        \"command\": \"tmpfile=$(mktemp -t tail-exception).command; printf '#!\/bin\/zsh\\nclear\\ntail -n 100 -f \\\"%s\\\"\\n' '${serverinfo.serverHomeDirectory}\/WEB-INF\/cfusion\/logs\/exception.log' &gt; \\\"$tmpfile\\\"; chmod +x \\\"$tmpfile\\\"; open -a Terminal \\\"$tmpfile\\\"\"\n                    },\n                    {\n                        \"label\": \"Tail mailsent.log\",\n                        \"action\": \"runAsync\",\n                        \"command\": \"tmpfile=$(mktemp -t tail-mailsent).command; printf '#!\/bin\/zsh\\nprintf \\\"\\\\e]0;Tail mailsent.log\\\\a\\\"\\nclear\\ntail -n 100 -f \\\"%s\\\"\\n' '${serverinfo.serverHomeDirectory}\/WEB-INF\/cfusion\/logs\/mailsent.log' &gt; \\\"$tmpfile\\\"; chmod +x \\\"$tmpfile\\\"; open -a Terminal \\\"$tmpfile\\\"\"\n                    }\n                ]\n            }\n        ]\n    }\n]<\/code><\/pre>\n<h2 id=\"explanation-of-the-tail-command\">Explanation of the tail command<\/h2>\n<p>This command creates a temporary shell script, makes it executable, and opens it in Terminal.\u00a0<strong>Reminder: this version is macOS only as written because it uses\u00a0<code>zsh<\/code>,\u00a0<code>mktemp<\/code>, and\u00a0<code>open -a Terminal<\/code>.<\/strong><\/p>\n<pre><code>\"command\": \"tmpfile=$(mktemp -t tail-mailsent).command; printf '#!\/bin\/zsh\\nprintf \\\"\\\\e]0;Tail mailsent.log\\\\a\\\"\\nclear\\ntail -n 100 -f \\\"%s\\\"\\n' '${serverinfo.serverHomeDirectory}\/WEB-INF\/cfusion\/logs\/mailsent.log' &gt; \\\"$tmpfile\\\"; chmod +x \\\"$tmpfile\\\"; open -a Terminal \\\"$tmpfile\\\"\"<\/code><\/pre>\n<h3 id=\"what-it-does\">What it does<\/h3>\n<ul>\n<li><code>mktemp -t tail-mailsent<\/code>\n<ul>\n<li>Creates a uniquely named temporary file.<\/li>\n<\/ul>\n<\/li>\n<li><code>printf '#!\/bin\/zsh ...'<\/code>\n<ul>\n<li>Writes a small shell script into the temporary file.<\/li>\n<\/ul>\n<\/li>\n<li><code>printf \"\\e]0;Tail mailsent.log\\a\"<\/code>\n<ul>\n<li>Sets the Terminal window title.<\/li>\n<\/ul>\n<\/li>\n<li><code>clear<\/code>\n<ul>\n<li>Clears the Terminal window before output begins.<\/li>\n<\/ul>\n<\/li>\n<li><code>tail -n 100 -f<\/code>\n<ul>\n<li>Displays the last 100 lines of the log file and continues following new entries in real time.<\/li>\n<\/ul>\n<\/li>\n<li><code>chmod +x<\/code>\n<ul>\n<li>Makes the temporary script executable.<\/li>\n<\/ul>\n<\/li>\n<li><code>open -a Terminal<\/code>\n<ul>\n<li>Opens the script in the macOS Terminal application.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2 id=\"next-steps\">Next Steps<\/h2>\n<p>There are all kinds of other tasks that could be added to the tray such as:<\/p>\n<ul>\n<li>Ping a server<\/li>\n<li>Flushing DNS<\/li>\n<li>Open the hosts file to edit<\/li>\n<li>Open the site&#8217;s Git repo<\/li>\n<\/ul>\n<p>Good luck!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve always been a fan of the tray that&#8217;s available when CommandBox launches. On the Mac, it appears as a menu bar icon in the top menu (first icon below). It has some very convenient built-in options: Servername \u251c\u2500\u2500 Stop Server \u251c\u2500\u2500 Restart Server \u251c\u2500\u2500 Open&#8230; \u2502 \u251c\u2500\u2500 Webroot \u2502 \u251c\u2500\u2500 Server Home \u2502 \u251c\u2500\u2500 &#8230; <a title=\"Add items (like Mailpit or tailing logs) to the CommandBox Tray\" class=\"read-more\" href=\"https:\/\/csimmons.dev\/blog\/2026\/05\/add-items-like-mailpit-or-tailing-logs-to-the-commandbox-tray\/\" aria-label=\"Read more about Add items (like Mailpit or tailing logs) to the CommandBox Tray\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"_cloudinary_featured_overwrite":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[68],"tags":[48,52,12,78],"class_list":["post-3010","post","type-post","status-publish","format-standard","hentry","category-developer","tag-coldfusion","tag-commandbox","tag-developer","tag-mailpit"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pbVg43-My","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/posts\/3010","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/comments?post=3010"}],"version-history":[{"count":0,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/posts\/3010\/revisions"}],"wp:attachment":[{"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/media?parent=3010"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/categories?post=3010"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/tags?post=3010"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}