This post shows you how to install phpunit globally so that you and your applications can access it from anywhere while running tests.

Current status

inanzzz@inanzzz:~$ phpunit --version
The program 'phpunit' is currently not installed. You can install it by typing:
sudo apt-get install phpunit

Get package

inanzzz@inanzzz:~$ wget
--2015-03-27 19:46:12--
Resolving (
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3411356 (3.3M) [application/octet-stream]
Saving to: ‘phpunit.phar’

100%[==============================================================================>] 3,411,356 881KB/s in 3.9s

2015-03-27 19:46:17 (846 KB/s) - ‘phpunit.phar’ saved [3411356/3411356]

Grant executable permissions

inanzzz@inanzzz:~$ chmod +x phpunit.phar


Path /usr/local/bin/ is for programs that user can run.

inanzzz@inanzzz:~$ sudo mv phpunit.phar /usr/local/bin/phpunit
[sudo] password for inanzzz:


inanzzz@inanzzz:~$ phpunit --version
PHPUnit 4.5.0 by Sebastian Bergmann and contributors.