Installing pecl and pear on OS X 10.11 El Capitan, macOS 10.12 Sierra, macOS 10.13 High Sierra ( Asked 4 years, 11 months ago
So it looks like the new ‘System Integrity Protection’ lockdown of /usr (among other directories) makes pear and pecl a non-starter. Has anyone found a workaround short of disabling it?
9 Answers 9
There’s a much easier way — no need to disable SIP or download your own copy:
You shouldn’t install binaries into system /usr , use /usr/local instead.
The pecl and pear commands should come along with PHP when installing via Homebrew.
Here is the example installing PHP with the latest Homebrew:
or the specific version:
To find your pecl and pear commands, run:
If you don’t have it, consider uninstalling previous PHP version or run reinstall instead.
You can also try to relink it by:
Alternatively download Pear it directly as a Phar package:
or with this following one-liner (will work on Linux, but not on Unix):
From this link: http://jason.pureconcepts.net/2012/10/install-pear-pecl-mac-os-x/ With this instructions, you don’t need to disable ‘System Integrity Protection’
The following instructions install PEAR and PECL on Mac OS X under /usr/local/. PECL is bundled with PEAR. So this is as simple as installing PEAR on Mac OS X.
PEAR is PHP’s Package Repository and makes it easy to download and install PHP tools like PHPUnit and XDebug. I specifically recommend these two for every PHP developer.
Download PEAR
Configure and Install PEAR
You should now be at a prompt to configure PEAR.
- Type 1 and press return .
Type 4 and press return .
Verify PEAR.
You should be able to type:
Eventually, if you use any extensions or applications from PEAR, you may need to update PHP’s include path.
How to install PHP, Pear, PECL, and APC with Homebrew on Mac OS X?
I’m trying to install APC for PHP 5.3 in the easiest way possible. I love Homebrew so I started down that route. I was able to install PHP 5.3.6 with this command:
I think this is supposed to install PHP, Pear, and PECL. It seems to install these just fine.
Now when I try to install APC:
How can I fix this?
5 Answers 5
Now homebrew-php has been migrated to homebrew-core and by default, PECL should be installed along with your PHP.
Here are the suggested steps:
- Reinstall PHP via: brew install php .
- Check pecl command by: which -a pecl .
To see which files were installed, see: brew list php .
To install PHP extensions, you need to use PECL as a recommended way.
With the migration to Homebrew-core the php formula has stopped taking over the role of PECL. Installing xdebug can (and should) be done through PECL. Source: GH-26007
For example: pecl install apc or pecl install xdebug .
If you’ve got some problem installing the extension, you need to report it to its maintainer. Check PECL website for more details.
pecl and pear are provided with Homebrew’s version of PHP:
If you’re weary that pecl and pear are provided by php, try this:
Both locations should symlink to Cellar/php/.
Note, macOS provides a php version which is generally behind that of Homebrew. To make sure you’re running the Homebrew version, prefix your php commands with $(brew —prefix php)/bin .
Example for Composer:
The reason this is important is because common extensions — such as ext-intl and ext-gettext are provided automatically and will fix these automatically.
Notice, for php-fpm , use brew reinstall php —with-fpm . The php-fpm path will be. $(brew —prefix php)/sbin/php-fpm .
Установка pecl и груши на OS X 10.11 El Capitan, macOS 10.12 Sierra, macOS 10.13 High Sierra
Таким образом, похоже, что новая защита «System Integrity Protection» от / usr (среди других каталогов) делает грушу и не имеет значения для стартера. Кто-нибудь нашел обходное решение, чтобы отключить его?
Там намного проще – нет необходимости отключать SIP или загружать собственную копию:
Вы не должны устанавливать двоичные файлы в систему /usr , вместо этого используйте /usr/local .
Вы можете установить pear с помощью Homebrew:
Примечание. Если команда выше не работает, убедитесь, что вы добавили красную метку сначала: brew tap homebrew/homebrew-php .
Примечание. Вы также можете ввести reinstall если у вас уже php56 пакет php56 .
или непосредственно загружая пакет Phar:
Затем у вас должны быть pecl и pear двоичные файлы вместе с вашим php
Если нет, добавьте его:
И pecl вы должны иметь его вместе с php при установке через brew install php56 . Если нет , попробуйте связать его вручную:
По этой ссылке: http://jason.pureconcepts.net/2012/10/install-pear-pecl-mac-os-x/ С помощью этих инструкций вам не нужно отключать «Системная защита целостности»,
Вот ссылка на статью Macworld, в которой описывается, как включить и отключить «Системную защиту целостности».
Это работало для меня как MacOS Sierra 10.12.1 для обновления PHP, установки PEAR и V8
Installing PHP imagick through PECL on Mac
I’m trying to get the php imagick extension installed on a Mac with High Sierra 10.13.5.
I have PHP 7.2 installed through brew and PEAR 1.10.5 installed. When trying to install imagick using sudo pecl install imagick I get:
It looks like I’m hitting the Mac permissions where the install directory should be in /usr/local but I cant figure out how to change it. Any ideas how to fix this?
1 Answer 1
In the end I needed PHP 7.1 not 7.2 but I still had the same problem.
Not sure if all of the steps I took were necessary but here’s how I got around it:
- Get the current php extensions directory from running php-config
- Copy everything from that directory (in my case /usr/lib/php/extensions/no-debug-non-zts-20160303) to the equivalent in /usr/local so in my case to /usr/local/lib/php/extensions/no-debug-non-zts-20160303
- Update the php.ini and set the extensions_dir to the new directory in /usr/local
- Go to the build directory from pecl error and find the imagick tgz
- Extract this and enter the created directory
- As root:
- run ./phpize
- run ./configure
- run make
- Edit the makefile and change the include directory to the /usr/local equivalent.
- run make install
- Edit the php.ini and add imagick.so to the extensions section
It seems to be working for me now but this probably isn’t the easiest way to go about getting it installed.
Installing/enabling PHP Pecl Intl extension on a default Mac OS X Leopard bundled PHP configuration
How can I install or enable the PHP Pecl Intl extension in my PHP environment?
I’ve got a stock PHP configuration that came bundled with Mac OS X Snow Leopard. Installing libicu from source and than $pecl install intl results in the following error:
Any help is really appreciated!
4 Answers 4
Here’s what I did in OSX 10.9 Mavericks:
Install some dependencies with Homebrew:
please enter this commend in Yosemite or El Capitan xcode-select –-install – Kannika May 19 ’16 at 1:29
For the time being I’ve recompiled my PHP installation. I’ve created a gist with my configure string which I’ll keep updating.
update
liip have created a nice binary that circumvents all these troubles. It is based on the original entropy.ch binary, I recomend using it for PHP development on a Mac.
Better late than never, but if you are like me and installed PHP directly from php.net (instead of using something like Homebrew or Port, then you can simply follow the following link to install Pear and PECL:
It worked fine for me.
on my Mac I installed a php version with pear using brew. This solved all my issues as the default osX php didn’t work for me after trying many different ways. You can try without installing php/pear if you have already done so.
brew install php56 —with-pear or brew install php56 pear
brew install autoconf
brew install icu4c
Creates the symlinks
brew link —force icu4c
Install intl with (pearl) pecl
sudo pecl install intl
Homebrew should enable intl and symlink all the right versions to their respective commands.
MAMP and Pecl Installation on Mac OSX for setting up PHP extensions
I had huge problems making pecl run on my MAMP 1.9 on Mac OSX and after spending a day on this whole thing I solved it, so I thought I’d share it with the others. If you know a better way to do that, perhaps you could tell me?
Basically, the problem was that I needed to install a few PHP extensions on my MAMP system and in order to do that I needed either pecl or compiler to work. None were functioning though. So the first thing I did was to upgrate to MAMP 2. Then after this I added the path to the MAMP’s pecl to the ./profile typing into terminal:
You can then check if your call for pecl is referring to the «correct» version (and not Mac Osx’s internal one) by typing in:
Now in order to be able to build the extensions using pecl we need to prepare the build environment for them to compile correctly. A good advice is given on this page. In short, you need to download MAMP’s libraries from their website, then choose the folder with PHP that corresponds to your currently activated version (in my case it was php-5.3.6) and copy it to /Applications/MAMP/bin/php/php5.3.6/include folder. After that you should go into that folder in terminal and run
Now, this will work only if you have XCode installed. The problem though is even if it’s installed, the newer versions of XCode doesn’t include command-line tools such as gcc compilers (that you need) by default. So what you need to do is to either download it through XCode or from Apple’s website. Once you download these command line tools you should have gcc installed and the ./configure command should work fine.
If that’s not the case, you could also install MacPort and then use it to install gcc and autoconf – the tools needed for compiling.
Although it may be that they are already working as part of XCode’s command line tools.
In any case, after all that is done, you’ll finally be able to run ./configure in your php source folder, have it prepared for future work and you can check if it functions by typing in:
(in order to have that extension initialized you’ll probably need to add extensions=uploadprogress.so into your php.ini file)
That’s all, I just thought I’d lay it all out, because it took me hours to find the right sequence of actions and I hope it will save time for someone else. If you have ideas for how it could be done more efficiently, let me know.