1. Installing homebrew
What is homebrew?
Official explanation:
Homebrew is the simplest and most flexible way to install UNIX tools that Apple does not include in MacOS.
Official website: Portal
Git repository Address: Portal
- How do I install the
-
Homebrew? How to uninstall?
- Install, open terminal, copy and paste, about 1 minutes, download complete, the process need to enter a password, other do not need any action:
/usr/bin/ruby -e "$ (Curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install) "
- Uninstall, install will have to uninstall, open Terminal, copy and paste:
actually only use the above installation Install and Replace with uninstall on the line.
/usr/bin/ruby -e " $ (Curl-fssl https:// Raw.githubusercontent.com/homebrew/install/master/uninstall) "
How to use Homebrew? What are the common commands?
list更新Homebrew,如:brew update
Homebrew Build complete diagram
Attention:
Due to network reasons, may not be successful, please try a few more times, until the successful installation.
In the middle there will be a press return to the continue or any other key to abort, please enter in time, and input the password, do not wait silly ...
Don't add sudo, it doesn't matter, you will be prompted to do not run as root
If a package is causing the installation to fail, you only need to follow the instructions to
When you see the following content
? Indicates that the installation has completed successfully.
==================================== installation redis==================================
Installing Redis with homebrew can reduce the amount of installation and configuration effort.
First, the installation of Redis
brew install redis
Message after installation is complete
Boot up Redis command
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
Starting Redis server with Launchctl
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
To start Redis server using a configuration file
redis-server /usr/local/etc/redis.conf
Stop the Redis server from booting
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
Location of Redis configuration files
/usr/local/etc/redis.conf
Uninstalling Redis and its files
brew uninstall redis rm ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
Test if Redis server is started
redis-cli ping
Second, after the installation of Redis, then install the Phpredis extension (all installed on the MAC)
#这里根据你的PHP版本决定,我的是php70,所以安装php70的扩展
Edit your php.ini and add the following code to the end:
extension=redis.so
Restart your php-fpm.
sudo killall php-fpm #关闭php-fpm
- This is the way I start php-fpm.
- Cd/usr/local/cellar/php70/7.0.26_18/sbin/sudo
- ./php70-fpm Start
Check if there is a redis extension
php -m | grep redis
Last PHP test code:
- <?php
- $redis = new Redis ();
- $redis->connect (' 127.0.0.1 ', 6379);
- $redis->set (' test ', '11111111111 ');
- $result = $redis->get (' test ');
- Var_dump ($result);
The browser shows that the installation was successful:
mac-Installing Redis