I wanted to test my plugin’s Redis queue locally, so I had to find a way of installing Redis in Local.
Prerequisite
- shivammathur/php, the same PHP version as the one you are running in Local:
brew tap shivammathur/php
brew install shivammathur/php/php@8.3
brew link --overwrite --force shivammathur/php/php@8.3
- Install Redis and extensions needed by Redis from shivammathur/extensions:
brew tap shivammathur/extensions
brew install shivammathur/extensions/msgpack@8.3
brew install shivammathur/extensions/igbinary@8.3
brew install shivammathur/extensions/redis@8.3
Adding the extension to Local
- Locate the Local extension folder
Mine was in~/Library/Application Support/Local/lightning-services/php-8.3.23+0/bin/darwin-arm64/lib/php/extensions/no-debug-non-zts-20230831 - Copy the shivammathur extensions to Local extension folder
The shivammathur extensions are in/opt/homebrew/Cellar/<name>@<PHP version>/<extension version>/<filename>.soeg:
/opt/homebrew/Cellar/msgpack@8.3/3.0.0/msgpack.so
/opt/homebrew/Cellar/igbinary@8.3/3.2.16/igbinary.so
/opt/homebrew/Cellar/redis@8.3/6.2.0/redis.so
- In Local extension folder, sign the extensions for macOS security:
codesign -s - -f msgpack.so
codesign -s - -f igbinary.so
codesign -s - -f redis.so
Load the extension
- Open
<Your Site>/conf/php/php.ini.hbs, in your favorite editor, and add the following at the end of the file:
[ini]
extension = {{extensionsDir}}/msgpack.so
extension = {{extensionsDir}}/igbinary.so
extension = {{extensionsDir}}/redis.so
- Restart Local
Test
- In the Site Shell, test if Redis was loaded:
php -m | grep redis
NOTE: This should work for other extensions ![]()
NOTE 2: This might also work on Linux. shivammathur/php supports the following operating systems:
| Operating System | Architecture |
|---|---|
| Linux | x86_64, arm64 |
| macOS Sonoma | x86_64, arm64 |
| macOS Sequoia | x86_64, arm64 |
| macOS Tahoe | x86_64, arm64 |