Installing ImageMagick on Laravel Valet
Recently, while working on one of my Laravel projects, I encountered a dependency that required ImageMagick. It was at that moment when I realised my Laravel Valet was lacking this library.
Valet relies on Homebrew for PHP, and unfortunately, ImageMagick isn't bundled with this setup by default. For reference, here's the Homebrew PHP repository: homebrew-php/Formula/php@8.2.rb (github.com)
During my search for a solution, I stumbled upon a helpful thread on Laracasts that provided the solution I needed.
Solution
Step 1: Installing ImageMagick via Homebrew
brew install imagemagick
Step 2: Verifying pkg-config
Installation
Ensured that pkg-config
, essential for compiling and linking libraries, was in place:
brew install pkg-config
Step 3: Imagick PHP Extension Installation
The next command involved installing the Imagick
PHP extension via pecl
.
pecl install imagick
Imagick is a PHP extension to create and modify images using the ImageMagick library.
Step 4: Restarting Valet
Restart the Valet service to activate the changes.
valet restart
If you encounter any issues or have further questions, feel free to drop a comment below! Thank you for taking the time to read this article!