<?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>Forem: mouhssine nabil</title>
    <description>The latest articles on Forem by mouhssine nabil (@cherradix).</description>
    <link>https://forem.com/cherradix</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%2F912772%2F3509ef61-886e-4157-bd49-3047e7e0c88c.png</url>
      <title>Forem: mouhssine nabil</title>
      <link>https://forem.com/cherradix</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/cherradix"/>
    <language>en</language>
    <item>
      <title>How to Set Up Xdebug with Laravel Herd and PhpStorm on macOS</title>
      <dc:creator>mouhssine nabil</dc:creator>
      <pubDate>Tue, 02 Dec 2025 21:54:04 +0000</pubDate>
      <link>https://forem.com/cherradix/how-to-set-up-xdebug-with-laravel-herd-and-phpstorm-on-macos-j3e</link>
      <guid>https://forem.com/cherradix/how-to-set-up-xdebug-with-laravel-herd-and-phpstorm-on-macos-j3e</guid>
      <description>&lt;p&gt;A complete, step-by-step guide to configure Xdebug for debugging Laravel applications using Herd and PhpStorm.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Prerequisites&lt;/li&gt;
&lt;li&gt;Understanding the Setup&lt;/li&gt;
&lt;li&gt;Step 1: Configure Xdebug in Herd&lt;/li&gt;
&lt;li&gt;Step 2: Configure PhpStorm&lt;/li&gt;
&lt;li&gt;Step 3: Testing the Setup&lt;/li&gt;
&lt;li&gt;Common Issues and Solutions&lt;/li&gt;
&lt;li&gt;Tips and Best Practices&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;macOS&lt;/strong&gt; (Apple Silicon or Intel)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Laravel Herd&lt;/strong&gt; installed and running&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PhpStorm&lt;/strong&gt; IDE&lt;/li&gt;
&lt;li&gt;A Laravel project served by Herd&lt;/li&gt;
&lt;li&gt;Basic knowledge of terminal commands&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Understanding the Setup
&lt;/h2&gt;

&lt;p&gt;Before diving in, it's important to understand how the components work together:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Xdebug&lt;/strong&gt;: PHP extension that enables debugging&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Herd&lt;/strong&gt;: Manages PHP, Nginx, and serves your Laravel applications&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PhpStorm&lt;/strong&gt;: Listens for debugging connections from Xdebug&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Browser Extension&lt;/strong&gt;: Triggers Xdebug to activate for web requests&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Key Concepts
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;PHP CLI vs PHP-FPM&lt;/strong&gt;: Herd uses different PHP processes for command-line (CLI) and web requests (FPM)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Debug Socket&lt;/strong&gt;: Herd has separate sockets for normal and debug modes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Port Configuration&lt;/strong&gt;: Xdebug connects to PhpStorm on port 9003 by default&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Step 1: Configure Xdebug in Herd
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1.1 Identify Your PHP Version and Architecture
&lt;/h3&gt;

&lt;p&gt;First, determine your PHP version and Mac architecture:&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;# Check PHP version&lt;/span&gt;
php &lt;span class="nt"&gt;-v&lt;/span&gt;

&lt;span class="c"&gt;# Check architecture (arm64 = Apple Silicon, x86 = Intel)&lt;/span&gt;
&lt;span class="nb"&gt;uname&lt;/span&gt; &lt;span class="nt"&gt;-m&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  1.2 Configure the Debug Configuration File
&lt;/h3&gt;

&lt;p&gt;Herd includes Xdebug extensions but requires configuration. Edit the debug configuration file:&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;# Open the debug.ini file for your PHP version&lt;/span&gt;
&lt;span class="c"&gt;# Replace '83' with your PHP version (82, 81, etc.)&lt;/span&gt;
nano ~/Library/Application&lt;span class="se"&gt;\ &lt;/span&gt;Support/Herd/config/php/83/debug/debug.ini

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the following configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# For Apple Silicon (M1/M2/M3)
zend_extension=/Applications/Herd.app/Contents/Resources/xdebug/xdebug-83-arm64.so

# For Intel Mac, use this instead:
# zend_extension=/Applications/Herd.app/Contents/Resources/xdebug/xdebug-83-x86.so

xdebug.mode=debug,develop
xdebug.start_with_request=yes
xdebug.start_upon_error=yes
xdebug.client_host=127.0.0.1
xdebug.client_port=9003
xdebug.idekey=PHPSTORM

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Important Notes:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Replace &lt;code&gt;83&lt;/code&gt; with your PHP version (e.g., &lt;code&gt;82&lt;/code&gt; for PHP 8.2)&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;arm64&lt;/code&gt; for Apple Silicon or &lt;code&gt;x86&lt;/code&gt; for Intel&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;127.0.0.1&lt;/code&gt; instead of &lt;code&gt;localhost&lt;/code&gt; to avoid DNS resolution issues&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  1.3 Optional: Configure the Main php.ini (for CLI debugging)
&lt;/h3&gt;

&lt;p&gt;If you also want to debug CLI commands (artisan, tests):&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;# Open php.ini&lt;/span&gt;
nano ~/Library/Application&lt;span class="se"&gt;\ &lt;/span&gt;Support/Herd/config/php/83/php.ini

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the same Xdebug configuration as above.&lt;/p&gt;

&lt;h3&gt;
  
  
  1.4 Restart Herd
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;herd restart

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After restarting, you should NOT see connection errors in the output. If you see errors, don't worry - they appear because PhpStorm isn't listening yet.&lt;/p&gt;

&lt;h3&gt;
  
  
  1.5 Verify Xdebug Installation
&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;# Check if Xdebug is loaded&lt;/span&gt;
php &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;span class="c"&gt;# You should see "with Xdebug v3.x.x"&lt;/span&gt;

&lt;span class="c"&gt;# View Xdebug configuration&lt;/span&gt;
php &lt;span class="nt"&gt;--ri&lt;/span&gt; xdebug | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-E&lt;/span&gt; &lt;span class="s2"&gt;"client_host|client_port|mode"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;xdebug.mode =&amp;gt; debug,develop
xdebug.client_host =&amp;gt; 127.0.0.1
xdebug.client_port =&amp;gt; 9003
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 2: Configure PhpStorm
&lt;/h2&gt;

&lt;h3&gt;
  
  
  2.1 Configure PHP Interpreter
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;strong&gt;PhpStorm&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;Settings/Preferences&lt;/strong&gt; (&lt;code&gt;Cmd + ,&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Navigate to &lt;strong&gt;PHP&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Next to &lt;strong&gt;CLI Interpreter&lt;/strong&gt;, click the &lt;strong&gt;three dots&lt;/strong&gt; (&lt;code&gt;...&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;&lt;code&gt;+&lt;/code&gt;&lt;/strong&gt; button&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Other Local...&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Browse to Herd's PHP binary:&lt;br&gt;
(Or let PhpStorm auto-detect it)&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/Users/[your-username]/Library/Application Support/Herd/bin/php83
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Verify that PhpStorm shows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PHP version: 8.3.x&lt;/li&gt;
&lt;li&gt;Xdebug: 3.3.x ✓&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;OK&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  2.2 Configure Server
&lt;/h3&gt;

&lt;p&gt;This is crucial and often the source of problems.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In &lt;strong&gt;Settings&lt;/strong&gt;, go to &lt;strong&gt;PHP → Servers&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;&lt;code&gt;+&lt;/code&gt;&lt;/strong&gt; to add a new server&lt;/li&gt;
&lt;li&gt;Configure:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name&lt;/strong&gt;: &lt;code&gt;your-domain.test&lt;/code&gt; (e.g., &lt;code&gt;myapp.test&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Host&lt;/strong&gt;: &lt;code&gt;your-domain.test&lt;/code&gt; (same as name)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Port&lt;/strong&gt;: &lt;code&gt;443&lt;/code&gt; (if using HTTPS) or &lt;code&gt;80&lt;/code&gt; (if using HTTP)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Debugger&lt;/strong&gt;: &lt;code&gt;Xdebug&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;☐ Use path mappings&lt;/strong&gt;: Leave &lt;strong&gt;UNCHECKED&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Critical: Port Configuration&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If your Herd site uses HTTPS (most do by default), use port &lt;strong&gt;443&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;If using HTTP, use port &lt;strong&gt;80&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;To check: look at your browser URL - &lt;code&gt;https://&lt;/code&gt; = port 443, &lt;code&gt;http://&lt;/code&gt; = port 80&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Apply&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Pro Tip&lt;/strong&gt;: If you're unsure about the port, delete the server configuration and PhpStorm will auto-detect it on the first connection and suggest the correct port (usually 443).&lt;/p&gt;

&lt;h3&gt;
  
  
  2.3 Configure Debug Settings
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;PHP → Debug&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Xdebug&lt;/strong&gt; section, verify:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Debug port&lt;/strong&gt;: &lt;code&gt;9003&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;☑ Can accept external connections&lt;/strong&gt;: Can be checked&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;☐ Force break at first line when no path mapping specified&lt;/strong&gt;: &lt;strong&gt;UNCHECKED&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;☐ Force break at first line when a script is outside the project&lt;/strong&gt;: &lt;strong&gt;UNCHECKED&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These last two options prevent PhpStorm from stopping at Herd's internal files.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;OK&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  2.4 Start Listening for Debug Connections
&lt;/h3&gt;

&lt;p&gt;In the PhpStorm toolbar (top right), find the &lt;strong&gt;phone icon&lt;/strong&gt; (📞) and click it to activate "Start Listening for PHP Debug Connections".&lt;/p&gt;

&lt;p&gt;The icon should turn &lt;strong&gt;green&lt;/strong&gt; when active.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Alternative&lt;/strong&gt;: Go to &lt;strong&gt;Run → Start Listening for PHP Debug Connections&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 3: Testing the Setup
&lt;/h2&gt;

&lt;h3&gt;
  
  
  3.1 CLI Debugging (Quick Test)
&lt;/h3&gt;

&lt;p&gt;Create a simple test file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="c1"&gt;// test-xdebug.php&lt;/span&gt;

&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Starting Xdebug test...&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;$name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Developer"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// ← Place breakpoint here&lt;/span&gt;
&lt;span class="nv"&gt;$message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Hello "&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$message&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Test finished.&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Place a breakpoint&lt;/strong&gt; on the line &lt;code&gt;$name = "Developer";&lt;/code&gt; (click in the left margin)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Save the file&lt;/strong&gt; (&lt;code&gt;Cmd + S&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ensure PhpStorm is listening&lt;/strong&gt; (green phone icon)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run from terminal&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php test-xdebug.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Expected Result:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Terminal pauses&lt;/li&gt;
&lt;li&gt;PhpStorm comes to the foreground&lt;/li&gt;
&lt;li&gt;The breakpoint line is highlighted in blue&lt;/li&gt;
&lt;li&gt;Variables panel shows values&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If this works, Xdebug is configured correctly! ✓&lt;/p&gt;

&lt;h3&gt;
  
  
  3.2 Web Debugging
&lt;/h3&gt;

&lt;p&gt;For debugging web requests, you need to trigger Xdebug from the browser.&lt;/p&gt;

&lt;h3&gt;
  
  
  Option A: Browser Extension (Recommended)
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Install Xdebug Helper&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Chrome: &lt;a href="https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc" rel="noopener noreferrer"&gt;Xdebug Helper&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Firefox: &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/xdebug-helper-for-firefox/" rel="noopener noreferrer"&gt;Xdebug Helper&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Configure the extension&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Click the extension icon&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;Options/Settings&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Set &lt;strong&gt;IDE Key&lt;/strong&gt; to &lt;code&gt;PHPSTORM&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Save&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Activate debugging&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Click the extension icon&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Debug&lt;/strong&gt; (icon turns green)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Option B: URL Parameter
&lt;/h3&gt;

&lt;p&gt;Add this to your URL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://your-domain.test/your-route?XDEBUG_SESSION_START=PHPSTORM
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3.3 Debug a Laravel Route
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;code&gt;routes/web.php&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Place a breakpoint inside a route:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Route&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/test-debug'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Testing Xdebug"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// ← Breakpoint here&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;view&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'welcome'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;compact&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'data'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Save the file&lt;/strong&gt; (&lt;code&gt;Cmd + S&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PhpStorm is listening&lt;/strong&gt; (green icon)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Browser extension is active&lt;/strong&gt; (green)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Visit the route&lt;/strong&gt;: &lt;code&gt;https://your-domain.test/test-debug&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Expected Result:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Browser page starts loading but pauses&lt;/li&gt;
&lt;li&gt;PhpStorm comes to foreground&lt;/li&gt;
&lt;li&gt;Breakpoint line is highlighted&lt;/li&gt;
&lt;li&gt;You can inspect all variables: &lt;code&gt;$data&lt;/code&gt;, &lt;code&gt;$request&lt;/code&gt;, etc.&lt;/li&gt;
&lt;li&gt;Use controls: &lt;strong&gt;Resume&lt;/strong&gt; (F9), &lt;strong&gt;Step Over&lt;/strong&gt; (F8), &lt;strong&gt;Step Into&lt;/strong&gt; (F7)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Common Issues and Solutions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Issue 1: "Could not connect to debugging client" Errors
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Symptoms&lt;/strong&gt;: Errors appear when running &lt;code&gt;herd restart&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cause&lt;/strong&gt;: Xdebug tries to connect but PhpStorm isn't listening yet&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;: These errors during Herd startup are &lt;strong&gt;normal and harmless&lt;/strong&gt;. They only matter if they appear when actually trying to debug.&lt;/p&gt;




&lt;h3&gt;
  
  
  Issue 2: CLI Debugging Works, Web Debugging Doesn't
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Symptoms&lt;/strong&gt;: Breakpoints work with &lt;code&gt;php artisan&lt;/code&gt; or terminal commands, but not from browser&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Root Causes&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Wrong port in PhpStorm server configuration&lt;/strong&gt; (most common)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PHP-FPM not loading Xdebug&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Browser extension not configured properly&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Solutions&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A. Fix Server Port Configuration&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If using HTTPS (default for Herd), set port to &lt;strong&gt;443&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;If using HTTP, set port to &lt;strong&gt;80&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;To auto-detect: Delete the server in PhpStorm, then debug from browser - PhpStorm will suggest the correct configuration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;B. Verify PHP-FPM Loads Xdebug&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Create &lt;code&gt;public/info.php&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="nb"&gt;phpinfo&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Visit &lt;code&gt;https://your-domain.test/info.php&lt;/code&gt; and search for "xdebug".&lt;/p&gt;

&lt;p&gt;If you DON'T see an Xdebug section, PHP-FPM isn't loading it. Verify the &lt;code&gt;debug.ini&lt;/code&gt; file path and restart Herd.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;C. Check Browser Extension&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Verify the extension is set to &lt;code&gt;PHPSTORM&lt;/code&gt; (not &lt;code&gt;YOUR-NAME&lt;/code&gt; or other values)&lt;/li&gt;
&lt;li&gt;Check cookies: Open DevTools → Application → Cookies&lt;/li&gt;
&lt;li&gt;You should see &lt;code&gt;XDEBUG_SESSION=PHPSTORM&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Issue 3: PhpStorm Doesn't Stop at Breakpoints
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Symptoms&lt;/strong&gt;: Everything seems configured, but PhpStorm doesn't react&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solutions&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A. Verify PhpStorm is Actually Listening&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;lsof &lt;span class="nt"&gt;-i&lt;/span&gt; :9003
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see PhpStorm listening on port 9003. If not, restart PhpStorm.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;B. Check Debug Settings&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Settings → PHP → Debug&lt;/li&gt;
&lt;li&gt;Verify "Ignore external connections through unregistered server configurations" is &lt;strong&gt;UNCHECKED&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;C. Accept First Connection&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The first time Xdebug connects, PhpStorm shows a popup: "Incoming connection from Xdebug"&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Accept&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;This popup might be hidden behind other windows - check!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;D. Enable Xdebug Logging&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Add to &lt;code&gt;debug.ini&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;xdebug.log=/tmp/xdebug.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Restart Herd, then check the log:&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;tail&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; /tmp/xdebug.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Issue 4: Breakpoint Stops at Herd's Internal Files
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Symptoms&lt;/strong&gt;: Debugger stops at files like &lt;code&gt;dump-loader.php&lt;/code&gt; instead of your code&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Settings → PHP → Debug&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Uncheck&lt;/strong&gt;: "Force break at first line when no path mapping specified"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Uncheck&lt;/strong&gt;: "Force break at first line when a script is outside the project"&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Issue 5: Using &lt;code&gt;localhost&lt;/code&gt; Instead of IP
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Symptoms&lt;/strong&gt;: Connection errors even though everything is configured&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;: Always use &lt;code&gt;127.0.0.1&lt;/code&gt; instead of &lt;code&gt;localhost&lt;/code&gt; in the Xdebug configuration. macOS can have DNS resolution issues with &lt;code&gt;localhost&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Tips and Best Practices
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Debugging Artisan Commands
&lt;/h3&gt;

&lt;p&gt;Use Herd's debug command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;herd debug artisan your:command
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or set environment variable:&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="nv"&gt;XDEBUG_CONFIG&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"idekey=PHPSTORM"&lt;/span&gt; php artisan your:command
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Debugging PHPUnit Tests
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;herd debug vendor/bin/phpunit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or in PhpStorm, create a PHPUnit run configuration with the Herd PHP interpreter.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Conditional Breakpoints
&lt;/h3&gt;

&lt;p&gt;Right-click a breakpoint → Add condition:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;PhpStorm will only stop when the condition is true.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Evaluate Expressions
&lt;/h3&gt;

&lt;p&gt;While debugging, select any expression in your code, right-click → &lt;strong&gt;Evaluate Expression&lt;/strong&gt; (or press &lt;code&gt;Alt + F8&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Quick Debugging Toggle
&lt;/h3&gt;

&lt;p&gt;Create a keyboard shortcut for "Toggle Line Breakpoint":&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Settings → Keymap → Search for "Toggle Line Breakpoint"&lt;/li&gt;
&lt;li&gt;Set to &lt;code&gt;Cmd + F8&lt;/code&gt; for quick breakpoint toggling&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  6. Xdebug Performance Impact
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Disable Xdebug when not needed&lt;/strong&gt; to maintain performance:&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;# Comment out the zend_extension line in debug.ini&lt;/span&gt;
&lt;span class="c"&gt;# Or use Herd Pro's auto-detection feature&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With Herd Pro, Xdebug only activates when breakpoints are detected, keeping your app fast.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Multiple Projects
&lt;/h3&gt;

&lt;p&gt;If working on multiple projects:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each project can have different server configurations in PhpStorm&lt;/li&gt;
&lt;li&gt;The server name should match the domain: &lt;code&gt;project1.test&lt;/code&gt;, &lt;code&gt;project2.test&lt;/code&gt;, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  8. Remote Debugging (Optional)
&lt;/h3&gt;

&lt;p&gt;If debugging from a different machine:&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;debug.ini&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;xdebug.client_host=192.168.x.x  # IP of machine running PhpStorm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also configure your firewall to allow connections on port 9003.&lt;/p&gt;




&lt;h2&gt;
  
  
  Troubleshooting Checklist
&lt;/h2&gt;

&lt;p&gt;When debugging doesn't work, verify ALL of these:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Herd Configuration:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[ ]  &lt;code&gt;debug.ini&lt;/code&gt; exists and contains correct configuration&lt;/li&gt;
&lt;li&gt;[ ]  Correct architecture (arm64/x86) specified&lt;/li&gt;
&lt;li&gt;[ ]  &lt;code&gt;xdebug.client_host=127.0.0.1&lt;/code&gt; (not localhost)&lt;/li&gt;
&lt;li&gt;[ ]  &lt;code&gt;xdebug.client_port=9003&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;[ ]  Herd restarted after config changes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;PhpStorm Configuration:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[ ]  PHP interpreter shows Xdebug loaded&lt;/li&gt;
&lt;li&gt;[ ]  Server name matches domain&lt;/li&gt;
&lt;li&gt;[ ]  Server port is correct (443 for HTTPS, 80 for HTTP)&lt;/li&gt;
&lt;li&gt;[ ]  Path mappings are disabled (unchecked)&lt;/li&gt;
&lt;li&gt;[ ]  Debug port is 9003&lt;/li&gt;
&lt;li&gt;[ ]  Force break options are unchecked&lt;/li&gt;
&lt;li&gt;[ ]  PhpStorm is listening (green phone icon)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Browser/Testing:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[ ]  Browser extension installed and configured&lt;/li&gt;
&lt;li&gt;[ ]  Extension IDE key is "PHPSTORM"&lt;/li&gt;
&lt;li&gt;[ ]  Extension is activated (green icon)&lt;/li&gt;
&lt;li&gt;[ ]  Breakpoint is placed and file is saved&lt;/li&gt;
&lt;li&gt;[ ]  Cookie &lt;code&gt;XDEBUG_SESSION=PHPSTORM&lt;/code&gt; exists&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Verification:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[ ]  &lt;code&gt;php -v&lt;/code&gt; shows Xdebug loaded&lt;/li&gt;
&lt;li&gt;[ ]  &lt;code&gt;lsof -i :9003&lt;/code&gt; shows PhpStorm listening&lt;/li&gt;
&lt;li&gt;[ ]  &lt;code&gt;phpinfo()&lt;/code&gt; from browser shows Xdebug section&lt;/li&gt;
&lt;li&gt;[ ]  CLI debugging works (&lt;code&gt;php test-file.php&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Setting up Xdebug with Laravel Herd and PhpStorm involves configuring three main components:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Xdebug&lt;/strong&gt; (via Herd's &lt;code&gt;debug.ini&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PhpStorm&lt;/strong&gt; (interpreter, server, debug settings)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trigger mechanism&lt;/strong&gt; (browser extension or URL parameter)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The most common pitfall is the &lt;strong&gt;server port configuration&lt;/strong&gt; - always verify you're using the correct port (443 for HTTPS, 80 for HTTP).&lt;/p&gt;

&lt;p&gt;Once configured correctly, you'll have a powerful debugging environment that works seamlessly for both CLI and web debugging.&lt;/p&gt;

&lt;p&gt;Happy debugging! 🐛✨&lt;/p&gt;




&lt;h2&gt;
  
  
  Additional Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://xdebug.org/docs/" rel="noopener noreferrer"&gt;Official Xdebug Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://herd.laravel.com/docs" rel="noopener noreferrer"&gt;Laravel Herd Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.jetbrains.com/help/phpstorm/debugging.html" rel="noopener noreferrer"&gt;PhpStorm Debugging Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc" rel="noopener noreferrer"&gt;Xdebug Helper Chrome Extension&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Tested With&lt;/strong&gt;: Laravel Herd 1.x, PhpStorm 2024.x, PHP 8.3, macOS Sonoma&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;More tips find me on *&lt;/em&gt;: &lt;a href="https://www.cherradix.dev" rel="noopener noreferrer"&gt;cherradiX.dev&lt;/a&gt;&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>laravel</category>
      <category>php</category>
      <category>tooling</category>
    </item>
    <item>
      <title>How to install (Ubuntu 22.10 VM) vagrant on Mac M1 ship using QEMU</title>
      <dc:creator>mouhssine nabil</dc:creator>
      <pubDate>Thu, 21 Mar 2024 18:20:01 +0000</pubDate>
      <link>https://forem.com/cherradix/how-to-install-ubuntu-2210-vm-vagrant-on-mac-m1-ship-using-qemu-3d4h</link>
      <guid>https://forem.com/cherradix/how-to-install-ubuntu-2210-vm-vagrant-on-mac-m1-ship-using-qemu-3d4h</guid>
      <description>&lt;p&gt;How to Ubuntu 22.10 (Kinetic Kudu) arm64 (Tested on macbook pro 2020 M1)&lt;/p&gt;

&lt;p&gt;In this blog post, I will show you how to install and run vagrant on an M1 Mac using QEMU as the virtualization provider. Vagrant is a tool that simplifies the creation and management of virtual machines for development and testing purposes. QEMU is an open source emulator that can run various architectures, including arm64, which is the native architecture of the M1 chip.&lt;/p&gt;

&lt;p&gt;Before we begin, make sure you have Homebrew installed on your Mac. Homebrew is a package manager that makes it easy to install software and dependencies. You can install Homebrew by following the instructions on their website: &lt;a href="https://brew.sh/" rel="noopener noreferrer"&gt;https://brew.sh/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Install QEMU&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;QEMU is the software that will emulate the arm64 architecture and run the virtual machine. To install QEMU, open a terminal and run the following command:&lt;br&gt;
&lt;/p&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;qemu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Find info about image here &lt;a href="https://app.vagrantup.com/perk/boxes/ubuntu-22.10-arm64" rel="noopener noreferrer"&gt;https://app.vagrantup.com/perk/boxes/ubuntu-22.10-arm64&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Install vagrant-qemu plugin&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vagrant plugin &lt;span class="nb"&gt;install &lt;/span&gt;vagrant-qemu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Init Vagrantfile&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vagrant init &lt;span class="nt"&gt;-m&lt;/span&gt; perk/ubuntu-22.10-arm64
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will generate a minimal Vagrantfile that uses the perk/ubuntu-22.10-arm64 box as the base image. A box is a pre-packaged virtual machine image that contains an operating system and some software. The perk/ubuntu-22.10-arm64 box is an arm64 version of Ubuntu 22.10 (Kinetic Kudu), which is compatible with the M1 chip.&lt;/p&gt;

&lt;p&gt;Alternatively, you can write your own Vagrantfile with more options and customizations. For example, you can add a line to forward a port from the guest to the host machine, like this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Or edit vagrant file like the following&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Vagrant.configure&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"2"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; |config|  config.vm.network :forwarded_port, guest: 86, host: 1990  config.vm.box &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"perk/ubuntu-22.10-arm64"&lt;/span&gt;end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Run vagrant&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This will download the box image if it is not already cached, create a new virtual machine based on the Vagrantfile, and boot it up using QEMU as the provider. You should see something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vagrant up &lt;span class="nt"&gt;--provider&lt;/span&gt; qemu# orvagrant up
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;SSH your OS&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Once the virtual machine is up and running, you can access it via SSH by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vagrant ssh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will log you in as the vagrant user, which has sudo privileges and can run commands as root. You should see something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Welcome to Ubuntu 22.10 (GNU/Linux 5.13.0-20-generic aarch64)

* Documentation: &amp;lt;https://help.ubuntu.com&amp;gt;
* Management: &amp;lt;https://landscape.canonical.com&amp;gt;
* Support: &amp;lt;https://ubuntu.com/advantage&amp;gt;

System information as of Fri Jun 9 20:54:10 UTC 2023

System load: 0.0 Processes: 103
Usage of /: 3.6% of 38.71GB Users logged in: 0
Memory usage: 7% IPv4 address for eth0: 10.0.2.15
Swap usage: 0%

* Super-optimized for your M1 Mac!

* Canonical Livepatch is available for installation.
- Reduce system reboots and improve kernel security. Activate at:
&amp;lt;https://ubuntu.com/livepatch&amp;gt;

0 updates can be installed immediately.
0 of these updates are security updates.

The list of available updates is more than a week old.
To check for new updates run: sudo apt update

*** System restart required ***
Last login: Fri Jun 9 20:54:10 2023 from 10.0.2.2
vagrant@ubuntu-22-10-arm64:~$

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👍 Now you can run any commands or install any software you want on the virtual machine, just like you would on a regular Ubuntu system.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
