Skip to content

Latest commit

 

History

History
59 lines (46 loc) · 3.01 KB

Getting-Started-With-Homebrew.md

File metadata and controls

59 lines (46 loc) · 3.01 KB

To get Phan running on a Mac with Homebrew, ensure that Homebrew is installed (see http://brew.sh) and then run the following:

If you had installed the outdated homebrew/php tap, you will need to uninstall the tap before installing the core php module.

Then, to install PHP 7.4 and php-ast, run the following commands (let me know if they do or don't work):

brew upgrade; # make sure all the other libs are up to date
brew cleanup; # cleanup old files
brew prune; # cleanup old symlinks
brew install autoconf; # Required by pecl
brew install php; # or [email protected], or [email protected], or [email protected]
pecl channel-update pecl.php.net;
# the below command should not echo ast. If it does, then it is already installed,
# and you don't need to run pecl install ast
php --modules | grep 'ast';
# Install other pecl modules that you are still missing in a similar fashion
# This may become out of date, see Phan's README for the recommended php-ast version.
pecl install ast-1.0.6;
php --modules | grep 'ast'; # should echo ast
# Note: If the project being analyzed had other dependencies such as APCu,
# you may wish to install those with pecl or look at
# https://github.com/phan/phan/wiki/How-To-Use-Stubs#internal-stubs
# If you were using php fpm and such prior to upgrading Phan
# (Completely unrelated to phan)
### brew services start php;

Once that completes successfully, you can check that phan is working correctly via any of the two other installation methods: (1) from phan.phar or (2) from source

# or phan.phar --help
phan --help

You can create an alias or symlink to phan for convenience (e.g. add an alias in .bashrc), or mark phan.phar as executable and move it into a folder in your $PATH environment variable):

# alias phan=/path/to/phan.phar
# alias phan=/path/to/phan-git-checkout/phan

Uninstalling the old homebrew/php tap

Note: as of Homebrew 1.5.0, the homebrew/php tap was removed (and replaced with php in core), so the installation instructions are more complicated

If you had the homebrew/php tap installed, or are upgrading from Homebrew < 1.5.0, then run the following commands before installing the latest php version:

brew update; # updates local brew metadata
# removes old homebrew php TAP, now php is in homebrew core
brew untap homebrew/php;
brew list | grep 'php'; # check for all php related installs
# php72-ast never existed, I think, so leave out brew uninstall php72-ast
brew uninstall php; # or brew uninstall php72 if you had that before

Note: If you are already using homebrew-php for other applications, upgrading homebrew (and removing the homebrew/php TAP) may cause other issues. For example, you may need to install other missing extensions and applications)