2

I am trying to install Imagick on my Mac, but I get this error after I use:

sudo pecl install imagick
ERROR: failed to mkdir /usr/include/php/ext/imagick

and here is the console log:

downloading imagick-3.4.3.tgz ...
Starting to download imagick-3.4.3.tgz (245,410 bytes)
...................................................done: 245,410 bytes
19 source files, building
running: phpize
Configuring for:
PHP Api Version:         20160303
Zend Module Api No:      20160303
Zend Extension Api No:   320160303
Please provide the prefix of Imagemagick installation [autodetect] :


If I press return, then it keeps loading lots of things and then I get the error:

Build process completed successfully
Installing '/usr/include/php/ext/imagick/php_imagick_shared.h'
ERROR: failed to mkdir /usr/include/php/ext/imagick
fmw42
  • 46,825
  • 10
  • 62
  • 80
Hesham El Masry
  • 363
  • 2
  • 8
  • 21
  • What happens if you switch to the root user (`sudo -i`) and attempt to install? – ZombieTfk Jul 09 '18 at 20:57
  • Try creating the folder first. Or check if it already exists. – Jonathan Jul 09 '18 at 21:01
  • https://bugzilla.redhat.com/show_bug.cgi?id=1071146 – ficuscr Jul 09 '18 at 21:08
  • @SamJudge sadly the same result – Hesham El Masry Jul 09 '18 at 21:21
  • Hmm, if it's not a permissions issue, it might be something wrong with the installer. If you've tried Jonathan's suggestion and that also did not work, or produced different errors, an alternative option might be to download the source code and manually compile the shared library files with phpize http://php.net/manual/en/install.pecl.phpize.php – ZombieTfk Jul 09 '18 at 21:36
  • Step 1. `Search for: "ERROR: failed to mkdir"`. Step 2. Find out its a permission issue. Step 3. Fix the permission issue.... I cannot simplify it better. – Xorifelse Jul 09 '18 at 21:57
  • I had similar issues and i was able to resolve them by cleaning the older php installations and then doing a fresh install. you may try same. http://www.testerlogic.com/install-php-extensions-macos-homebrew/ – TestingWithArif Aug 30 '18 at 07:09

2 Answers2

2

Reboot Your Mac

Hold Cmd + R

Open terminal

csrutil disable
reboot

run

sudo pecl install imagick

add

extension=/usr/lib/php/extensions/no-debug-non-zts-XXXXXX/imagick.so

to your php.ini after your instalation is done

reboot your mac Hold Cmd + R

Open terminal

csrutil enable
reboot
AcitJazz
  • 36
  • 2
0

Here is the answer to your question: Homebrew: install new formula php72-imagick

You may need to change the path for your modules. (read STEP 4 and 5 in particular).

timunix
  • 609
  • 6
  • 19