After reloading system, many environments need to be reconfigured.

MAC computer environment configuration

1. Homebrew

homebrew address

Introduction to Homebrew

homebrew is under Mac A package management tool. It is easy to install/uninstall/update various software packages, such as nodejs, elasticsearch, kibana, mysql, mongodb, etc. It can be used to quickly build various local environments and is an essential tool for programmers.

First install homebrew with the following command
Paste the following command into the terminal

/usr/bin/ruby -e "$(curl -fsSL https://raw. githubusercontent.com/Homebrew/install/master/install)"

Basic usage

Install/Uninstall/Update

Take nodejs as an example, execute the following command Yes

brew install nodejs

If you need to update or uninstall

brew upgrade nodejs
brew remove nodejs

Other commands< /h3>

brew list # List currently installed software
brew search nodejs # Query available software related to nodejs
brew info nodejs # Query nodejs installation information

2. Configure Apache

It is easy to set up lamp development environment under Mac. There are ready-made integrated environments for xampp and mamp. ​​However, the integrated environment is very troublesome for developers who often need to customize some configurations, and Mac It comes with apache and php, it is very easy to build manually with the help of brew, and the controllability is very high. It is 10.13.1, you can use the following commands to control Apache

sudo apachectl start
sudo apachectl restart
sudo apachectl stop

The only thing to change is the home directory, Mac by default has a Sites directory under home. The access path is http://localhost/~user_name. This is not easy to access. Modify the content of /etc/apache2/httpd.conf (yanyuanyuan is username)

< pre>DocumentRoot /Users/yanyuanyuan/Sites

Options Indexes MultiViews
# apache 2.2
# AllowOverride All
# Order allow,deny
Allow from all
Require all granted
# apache 2.4
# Require local

Uncomment the following part:

LoadModule php5_module libexec/apache2/libphp5.so< /pre> 

Test the test file and put it into index.php under yanyuanyuan/Sites


Remember to restart

sudo apache restart

In this way, the Sites directory is the root directory of the website, which can be accessed through http://localhost.

3. Install Nodejs

Take nodejs as an example, just execute the following command

brew install nodejs

If you need to update or uninstall

brew upgrade nodejs
brew remove nodejs

Leave a Comment

Your email address will not be published.