<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.planetoid.info/index.php?action=history&amp;feed=atom&amp;title=Integration_of_CodeRunner_with_MAMP</id>
	<title>Integration of CodeRunner with MAMP - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.planetoid.info/index.php?action=history&amp;feed=atom&amp;title=Integration_of_CodeRunner_with_MAMP"/>
	<link rel="alternate" type="text/html" href="https://wiki.planetoid.info/index.php?title=Integration_of_CodeRunner_with_MAMP&amp;action=history"/>
	<updated>2026-07-26T05:32:44Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://wiki.planetoid.info/index.php?title=Integration_of_CodeRunner_with_MAMP&amp;diff=26409&amp;oldid=prev</id>
		<title>Planetoid at 02:21, 15 July 2026</title>
		<link rel="alternate" type="text/html" href="https://wiki.planetoid.info/index.php?title=Integration_of_CodeRunner_with_MAMP&amp;diff=26409&amp;oldid=prev"/>
		<updated>2026-07-15T02:21:11Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:21, 15 July 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l138&quot;&gt;Line 138:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 138:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category: Programming]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category: Programming]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category: PHP]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category: PHP]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category: Revised with LLMs]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Planetoid</name></author>
	</entry>
	<entry>
		<id>https://wiki.planetoid.info/index.php?title=Integration_of_CodeRunner_with_MAMP&amp;diff=26408&amp;oldid=prev</id>
		<title>Planetoid: /* Summary of the Flow */ fix typo</title>
		<link rel="alternate" type="text/html" href="https://wiki.planetoid.info/index.php?title=Integration_of_CodeRunner_with_MAMP&amp;diff=26408&amp;oldid=prev"/>
		<updated>2026-07-15T02:20:41Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Summary of the Flow: &lt;/span&gt; fix typo&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:20, 15 July 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l136&quot;&gt;Line 136:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 136:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;The advantage&amp;#039;&amp;#039;&amp;#039;: it doesn&amp;#039;t depend on &amp;lt;code&amp;gt;which&amp;lt;/code&amp;gt;, aliases, or &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt; at all — because CodeRunner&amp;#039;s execution environment doesn&amp;#039;t load shell config files like &amp;lt;code&amp;gt;.zshrc&amp;lt;/code&amp;gt; (where aliases are defined), scanning the filesystem directly for the path is the most reliable approach. And future MAMP php version upgrades won&amp;#039;t require manually updating this setting again.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;The advantage&amp;#039;&amp;#039;&amp;#039;: it doesn&amp;#039;t depend on &amp;lt;code&amp;gt;which&amp;lt;/code&amp;gt;, aliases, or &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt; at all — because CodeRunner&amp;#039;s execution environment doesn&amp;#039;t load shell config files like &amp;lt;code&amp;gt;.zshrc&amp;lt;/code&amp;gt; (where aliases are defined), scanning the filesystem directly for the path is the most reliable approach. And future MAMP php version upgrades won&amp;#039;t require manually updating this setting again.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Catergory&lt;/del&gt;: Programming]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Category&lt;/ins&gt;: Programming]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Catergory&lt;/del&gt;: PHP]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Category&lt;/ins&gt;: PHP]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Planetoid</name></author>
	</entry>
	<entry>
		<id>https://wiki.planetoid.info/index.php?title=Integration_of_CodeRunner_with_MAMP&amp;diff=26407&amp;oldid=prev</id>
		<title>Planetoid at 02:18, 15 July 2026</title>
		<link rel="alternate" type="text/html" href="https://wiki.planetoid.info/index.php?title=Integration_of_CodeRunner_with_MAMP&amp;diff=26407&amp;oldid=prev"/>
		<updated>2026-07-15T02:18:52Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:18, 15 July 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= CodeRunner PHP Run Command: Auto-Detecting the Version =&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= CodeRunner PHP Run Command: Auto-Detecting the Version =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;# [https://coderunnerapp.com/ CodeRunner – Programming Editor for macOS]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;# [https://www.mamp.info/en/mac/ MAMP]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In Settings → Languages → PHP → Run Command, the default configuration usually looks like this:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In Settings → Languages → PHP → Run Command, the default configuration usually looks like this:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Planetoid</name></author>
	</entry>
	<entry>
		<id>https://wiki.planetoid.info/index.php?title=Integration_of_CodeRunner_with_MAMP&amp;diff=26406&amp;oldid=prev</id>
		<title>Planetoid: Created page with &quot;= CodeRunner PHP Run Command: Auto-Detecting the Version =  In Settings → Languages → PHP → Run Command, the default configuration usually looks like this:  &lt;pre lang=&quot;bash&quot;&gt; /path/to/php $filename &lt;/pre&gt;  For example:  &lt;pre lang=&quot;bash&quot;&gt; /Applications/MAMP/bin/php/php8.2.29/bin/php $filename &lt;/pre&gt;  The problem is that every time MAMP upgrades its PHP version, you have to come back and manually update this path. Changing it to the line below lets CodeRunner automat...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.planetoid.info/index.php?title=Integration_of_CodeRunner_with_MAMP&amp;diff=26406&amp;oldid=prev"/>
		<updated>2026-07-15T02:14:29Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;= CodeRunner PHP Run Command: Auto-Detecting the Version =  In Settings → Languages → PHP → Run Command, the default configuration usually looks like this:  &amp;lt;pre lang=&amp;quot;bash&amp;quot;&amp;gt; /path/to/php $filename &amp;lt;/pre&amp;gt;  For example:  &amp;lt;pre lang=&amp;quot;bash&amp;quot;&amp;gt; /Applications/MAMP/bin/php/php8.2.29/bin/php $filename &amp;lt;/pre&amp;gt;  The problem is that every time MAMP upgrades its PHP version, you have to come back and manually update this path. Changing it to the line below lets CodeRunner automat...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= CodeRunner PHP Run Command: Auto-Detecting the Version =&lt;br /&gt;
&lt;br /&gt;
In Settings → Languages → PHP → Run Command, the default configuration usually looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/path/to/php $filename&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/Applications/MAMP/bin/php/php8.2.29/bin/php $filename&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The problem is that every time MAMP upgrades its PHP version, you have to come back and manually update this path. Changing it to the line below lets CodeRunner automatically detect the &amp;quot;currently installed newest version&amp;quot; every time it runs:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/bin/sh -c &amp;#039;php=$(ls -d /Applications/MAMP/bin/php/php*/bin/php | sort -V | tail -1); &amp;quot;$php&amp;quot; &amp;quot;&amp;#039;&amp;quot;$filename&amp;quot;&amp;#039;&amp;quot;&amp;#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overall Structure ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/bin/sh -c &amp;#039;  command string  &amp;#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;-c&amp;lt;/code&amp;gt; tells &amp;lt;code&amp;gt;/bin/sh&amp;lt;/code&amp;gt; to treat the following text as a shell command to execute. Everything inside the single quotes &amp;lt;code&amp;gt;&amp;#039;...&amp;#039;&amp;lt;/code&amp;gt; is the actual script being run, just packed onto one line.&lt;br /&gt;
&lt;br /&gt;
== Step 1: Finding the newest php executable ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
php=$(ls -d /Applications/MAMP/bin/php/php*/bin/php | sort -V | tail -1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table class=&amp;quot;wikitable&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Segment &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; What it does &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; &amp;lt;code&amp;gt;ls -d /Applications/MAMP/bin/php/php*/bin/php&amp;lt;/code&amp;gt; &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Lists all files matching this path pattern &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; &amp;lt;code&amp;gt;sort -V&amp;lt;/code&amp;gt; &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Sorts by &amp;#039;&amp;#039;&amp;#039;version number&amp;#039;&amp;#039;&amp;#039; &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; &amp;lt;code&amp;gt;tail -1&amp;lt;/code&amp;gt; &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Takes the last line of the sorted output — the newest version &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; &amp;lt;code&amp;gt;php=$(...)&amp;lt;/code&amp;gt; &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt; Stores the result into the variable &amp;lt;code&amp;gt;php&amp;lt;/code&amp;gt; &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;What &amp;lt;code&amp;gt;ls -d&amp;lt;/code&amp;gt; does&amp;#039;&amp;#039;&amp;#039;: Normally, &amp;lt;code&amp;gt;ls&amp;lt;/code&amp;gt; on a directory lists its contents, but &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt; makes it list the matching path itself without descending into it. &amp;lt;code&amp;gt;php*&amp;lt;/code&amp;gt; is a wildcard matching every folder under &amp;lt;code&amp;gt;php&amp;lt;/code&amp;gt; that starts with &amp;lt;code&amp;gt;php&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/Applications/MAMP/bin/php/php8.1.33/bin/php&lt;br /&gt;
/Applications/MAMP/bin/php/php8.2.29/bin/php&lt;br /&gt;
/Applications/MAMP/bin/php/php8.3.14/bin/php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;What &amp;lt;code&amp;gt;sort -V&amp;lt;/code&amp;gt; does&amp;#039;&amp;#039;&amp;#039;: Regular &amp;lt;code&amp;gt;sort&amp;lt;/code&amp;gt; sorts as plain strings, which causes problems — &amp;lt;code&amp;gt;php8.10.0&amp;lt;/code&amp;gt; would sort &amp;#039;&amp;#039;before&amp;#039;&amp;#039; &amp;lt;code&amp;gt;php8.2.0&amp;lt;/code&amp;gt; (since character &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; is less than &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;). &amp;lt;code&amp;gt;-V&amp;lt;/code&amp;gt; (version sort) understands version-number semantics and correctly places &amp;lt;code&amp;gt;8.10.0&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;8.2.0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;lt;code&amp;gt;tail -1&amp;lt;/code&amp;gt;&amp;#039;&amp;#039;&amp;#039;: Takes the last line of the sorted result — the entry with the highest version number. So the whole &amp;lt;code&amp;gt;$(...)&amp;lt;/code&amp;gt; expression captures the full path to the newest installed MAMP php version.&lt;br /&gt;
&lt;br /&gt;
After this line runs, the &amp;lt;code&amp;gt;php&amp;lt;/code&amp;gt; variable holds something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/Applications/MAMP/bin/php/php8.2.29/bin/php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Step 2: Actually running php ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
&amp;quot;$php&amp;quot; &amp;quot;$filename&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;quot;$php&amp;quot;&amp;lt;/code&amp;gt;: retrieves the path stored earlier, wrapped in double quotes so it won&amp;#039;t break into multiple arguments if the path contains spaces.&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;quot;$filename&amp;quot;&amp;lt;/code&amp;gt;: a built-in CodeRunner variable, automatically replaced with the path of the currently open file.&lt;br /&gt;
&lt;br /&gt;
This is equivalent to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/Applications/MAMP/bin/php/php8.2.29/bin/php &amp;quot;/path/to/php_code_runner.php&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Why there&amp;#039;s a &amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt; in between ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
php=$(...); &amp;quot;$php&amp;quot; &amp;quot;$filename&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt; is the command separator, meaning &amp;quot;finish this command, then do the next one&amp;quot; — same as typing two separate lines:&lt;br /&gt;
&lt;br /&gt;
# First, find the php path and store it.&lt;br /&gt;
# Then, use that path to run the file.&lt;br /&gt;
&lt;br /&gt;
== Why &amp;lt;code&amp;gt;$filename&amp;lt;/code&amp;gt; uses that odd quoting pattern ==&lt;br /&gt;
&lt;br /&gt;
CodeRunner handles &amp;lt;code&amp;gt;$filename&amp;lt;/code&amp;gt; by directly replacing the text &amp;lt;code&amp;gt;$filename&amp;lt;/code&amp;gt; in the Run Command field with the actual file path string — it&amp;#039;s not spawning a shell first and passing in a variable. In other words, CodeRunner does &amp;#039;&amp;#039;&amp;#039;text substitution&amp;#039;&amp;#039;&amp;#039;, not shell variable expansion.&lt;br /&gt;
&lt;br /&gt;
Since the whole command is wrapped in single quotes &amp;lt;code&amp;gt;&amp;#039;...&amp;#039;&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;sh -c&amp;lt;/code&amp;gt;, the shell won&amp;#039;t expand anything inside those single quotes at all. If &amp;lt;code&amp;gt;$filename&amp;lt;/code&amp;gt; were left inside the single quotes, it would be treated as the &amp;#039;&amp;#039;&amp;#039;literal text&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;$filename&amp;lt;/code&amp;gt;, not the actual path CodeRunner substitutes in.&lt;br /&gt;
&lt;br /&gt;
The fix is to &amp;quot;step out&amp;quot; of the single-quoted string right where &amp;lt;code&amp;gt;$filename&amp;lt;/code&amp;gt; needs to go, let CodeRunner substitute it outside the quotes, then step back into the single-quoted string:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;&amp;#039;&amp;quot;$filename&amp;quot;&amp;#039;&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Broken down:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;&amp;#039;   →  closing double quote + closing single quote (temporarily exits the string)&lt;br /&gt;
&amp;quot;$filename&amp;quot;  →  outside the single quotes, so CodeRunner replaces it with the actual file path&lt;br /&gt;
&amp;#039;&amp;quot;   →  opening single quote + opening double quote (re-enters the string)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a common shell trick: &amp;#039;&amp;#039;&amp;#039;inserting content that needs to be expanded in the middle of a single-quoted string&amp;#039;&amp;#039;&amp;#039;. Since single quotes never expand anything inside them, the only way to splice in something that needs expanding is to end the single-quoted string, insert the piece, then start a new single-quoted string right after.&lt;br /&gt;
&lt;br /&gt;
== Summary of the Flow ==&lt;br /&gt;
&lt;br /&gt;
# CodeRunner first replaces &amp;lt;code&amp;gt;$filename&amp;lt;/code&amp;gt; with the actual file path as plain text (a pure string substitution that happens before the command reaches the shell).&lt;br /&gt;
# The resulting full string is passed to &amp;lt;code&amp;gt;/bin/sh -c&amp;lt;/code&amp;gt; for execution.&lt;br /&gt;
# The shell runs &amp;lt;code&amp;gt;ls | sort -V | tail -1&amp;lt;/code&amp;gt; to dynamically scan for the newest installed MAMP php executable path, storing it in the &amp;lt;code&amp;gt;php&amp;lt;/code&amp;gt; variable.&lt;br /&gt;
# That path is used to run your php file, with the file path passed as an argument.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;The advantage&amp;#039;&amp;#039;&amp;#039;: it doesn&amp;#039;t depend on &amp;lt;code&amp;gt;which&amp;lt;/code&amp;gt;, aliases, or &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt; at all — because CodeRunner&amp;#039;s execution environment doesn&amp;#039;t load shell config files like &amp;lt;code&amp;gt;.zshrc&amp;lt;/code&amp;gt; (where aliases are defined), scanning the filesystem directly for the path is the most reliable approach. And future MAMP php version upgrades won&amp;#039;t require manually updating this setting again.&lt;br /&gt;
&lt;br /&gt;
[[Catergory: Programming]]&lt;br /&gt;
[[Catergory: PHP]]&lt;/div&gt;</summary>
		<author><name>Planetoid</name></author>
	</entry>
</feed>