Mac miniにAIエージェント向けWordPress開発環境を構築
Mac miniにインストールしたAIエージェント(Claude Code)がローカルでWordPressの開発ができるようにした時の覚書。
環境: Mac mini 2024 メモリ24GB, Tahoe 26.5.1 → Tahoe 26.5.2
1. PHP 8.3とwp-cliのインストール
Homebrewで確認してインストール。
% brew update
% brew search php
% brew search wp-cli
% brew install php@8.3 wp-cli
下記エラー
==> Running `brew cleanup php@8.3`...Disable this behaviour by setting `HOMEBREW_NO_INSTALL_CLEANUP=1`.Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).Error: Your Command Line Tools are too outdated.Update them from Software Update in System Settings.If that doesn't show you any updates, run:sudo rm -rf /Library/Developer/CommandLineToolssudo xcode-select --installAlternatively, manually download them from:https://developer.apple.com/download/all/.You should download the Command Line Tools for Xcode 26.3.
まずは
システム設定 → 一般 → ソフトウェアアップデート
でmacOSを最新(Tahoe 26.5.2)にした。
再起動後、App Storeで「Xcode」をインストール。
Xcodeを起動して、コンポーネントをインストール。
コンソールで下記実行。
% xcode-select --install
xcode-select: note: Command line tools are already installed. Use "Software Update" in System Settings or the softwareupdate command line interface to install updates
大丈夫そうなので、再度インストール実行。
% brew install php@8.3 wp-cli
Error: Your Command Line Tools are too outdated.Update them from Software Update in System Settings.If that doesn't show you any updates, run:sudo rm -rf /Library/Developer/CommandLineToolssudo xcode-select --installAlternatively, manually download them from:https://developer.apple.com/download/all/.You should download the Command Line Tools for Xcode 26.3.
App StoreでXcodeのインストールは不要だったかも。
表示されたコマンドを実行。
% sudo rm -rf /Library/Developer/CommandLineTools
% sudo xcode-select --install
画面にダイアログが表示されるので、インストールを実行(5分ぐらい掛かった)。
再度インストール実行。
% brew install php@8.3 wp-cli
確認
% php --version
PHP 8.5.8 (cli) (built: Jul 1 2026 03:46:27) (NTS)Copyright (c) The PHP GroupBuilt by HomebrewZend Engine v4.5.8, Copyright (c) Zend Technologieswith Zend OPcache v8.5.8, Copyright (c), by Zend Technologies
PHP8.5になっているので、8.3に切り替える。
% brew unlink php
% brew link --overwrite --force php@8.3
% php --version
PHP 8.3.32 (cli) (built: Jul 1 2026 08:57:05) (NTS)Copyright (c) The PHP GroupZend Engine v4.3.32, Copyright (c) Zend Technologieswith Zend OPcache v8.3.32, Copyright (c), by Zend Technologies
wpコマンドの確認。
% wp --version
WP-CLI 2.12.0
wpコマンドのメモリ制限を引き上げて警告も抑制する。
% vim ~/.zshrc
# wp-cliexport WP_CLI_PHP_ARGS='-d memory_limit=512M -d error_reporting=E_ALL&~E_DEPRECATED'
反映させる。
% source ~/.zshrc
2. 仮想マシンのMariaDB Server設定
データベースは仮想マシン(Mac mini上のVMware Fusion)のMariaDBをMac miniから参照する。
仮想マシンで下記コマンドを実行。
# uname -a
FreeBSD vm-dev3 14.4-RELEASE-p7 FreeBSD 14.4-RELEASE-p7 #0 -dirty: Tue Jun 30 07:17:28 UTC 2026 root@arm64-builder.daemonology.net:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC arm64
ポートが空いているか確認。
# netstat -an -p tcp
MariaDB serverの設定変更。
「skip-networking」を外して、LANからのアクセスを許可。
# cd /usr/local/etc/mysql/conf.d
# less server.cnf
#skip-networking[mysqld]user = mysqlport = 3306 # inherited from /usr/local/etc/mysql/my.cnfbind-address = 0.0.0.0
MariaDB再起動。
# service mysql-server restart
ポート確認。
# netstat -an -p tcp
Active Internet connections (including servers)Proto Recv-Q Send-Q Local Address Foreign Address (state)tcp4 0 0 *.3306 *.* LISTEN
3.PHPビルトインサーバーを起動
WEBサーバーをインストールしなくても、PHPのビルトインサーバーでブラウザから確認できる。
% wp server --host=0.0.0.0 --port=8080
Windows11から確認するときは
C:\Windows\System32\drivers\etc\hosts
に名前解決を記載する。
Mac miniの/etc/hostsファイルも記載する。