DEV Community

Cover image for Install New Relic on Mac OS using homebrew php
Asrar
Asrar

Posted on

Install New Relic on Mac OS using homebrew php

1.Grab archive from https://download.newrelic.com/php_agent/release/ and decompressed
gzip -dc newrelic-php*.tar.gz | tar xf -
cd newrelic-php*/

2.Check homebrew's PHP extension path exists

ls -al /usr/local/Cellar/php@7.2/7.2.25/lib/php/20170718/

(My PHP version is 7.2 and lib version is 20170718. Yours might be different based on PHP version. But in any case, /usr/local/Cellar/php is a good direction.)

3.Run install script with custom paths (since /usr/bin is not writeable because of macOS "system integrity protection")

NR_INSTALL_INITFILE=/usr/local/bin/newrelic-daemon-service NR_INSTALL_DAEMONPATH=/usr/local/bin/newrelic-daemon ./newrelic-install

4.Now New Relic agent has been installed and the daemon can be started using sudo newrelic-daemon-service start

5.If you don't want to use sudo, you need to change owner and group of /var/log/newrelic/newrelic-daemon.log to your own user and group.

chown staff /var/log/newrelic/newrelic-daemon.log

Then simply run newrelic-daemon

6.Ensure New Relic daemon is up and running by running

ps aux | grep newrelic

That's it, have fun with APM data!

Discussion (0)