码迷,mamicode.com
首页 > 系统相关 > 详细

MAC OS brew的使用

时间:2019-12-01 19:16:29      阅读:123      评论:0      收藏:0      [点我收藏+]

标签:mys   because   without   flag   url   Opens   art   oca   port   

brew 是 Mac 下的一个包管理工具,类似于 centos 下的 yum,可以很方便地进行安装/卸载/更新各种软件包,例如:nodejs, elasticsearch, kibana, mysql, mongodb 等等,可以用来快速搭建各种本地环境,程序员必备工具

安装 brew

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

安装/卸载/更新

以 nodejs 为例,执行下面命令即可,安装目录在 /usr/local/Cellar

brew install nodejs

如果需要更新或卸载

brew upgrade nodejs
brew remove nodejs

 

brew list                   # 列出当前安装的软件
brew search nodejs          # 查询与 nodejs 相关的可用软件
brew info nodejs            # 查询 nodejs 的安装信息

如果需要指定版本,可以在 brew search 查看有没有需要的版本,在 @ 后面指定版本号,例如 brew install thrift@0.9

brew services

brew services 是一个非常强大的工具,可以用来管理各种服务的启停,有点像 linux 里面的 services,非常方便,以 elasticsearch 为例

brew install elasticsearch          # 安装 elasticsearch
brew services start elasticsearch   # 启动 elasticsearch
brew services stop elasticsearch    # 停止 elasticsearch
brew services restart elasticsearch # 重启 elasticsearch
brew services list                  # 列出当前的状态

 

brew services 服务相关配置以及日志路径

  • 配置路径:/usr/local/etc/
  • 日志路径:/usr/local/var/log

 

安装mysql:

brew install mysql

 

Weve installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot

To have launchd start mysql now and restart at login:
  brew services start mysql
Or, if you dont want/need a background service you can just run:
  mysql.server start
==> Summary
??  /usr/local/Cellar/mysql/8.0.18_1: 287 files, 278.6MB
==> Caveats
==> openssl@1.1
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl@1.1/certs

and run
  /usr/local/opt/openssl@1.1/bin/c_rehash

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because openssl/libressl is provided by macOS so dont link an incompatible version.

If you need to have openssl@1.1 first in your PATH run:
  echo export PATH="/usr/local/opt/openssl@1.1/bin:$PATH" >> ~/.zshrc

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

==> protobuf@3.7
protobuf@3.7 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have protobuf@3.7 first in your PATH run:
  echo export PATH="/usr/local/opt/protobuf@3.7/bin:$PATH" >> ~/.zshrc

For compilers to find protobuf@3.7 you may need to set:
  export LDFLAGS="-L/usr/local/opt/protobuf@3.7/lib"
  export CPPFLAGS="-I/usr/local/opt/protobuf@3.7/include"

==> mysql
Weve installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot

To have launchd start mysql now and restart at login:
  brew services start mysql
Or, if you dont want/need a background service you can just run:
  mysql.server start

 

mysql.server stop

 

 

参考链接

 

MAC OS brew的使用

标签:mys   because   without   flag   url   Opens   art   oca   port   

原文地址:https://www.cnblogs.com/ustc-anmin/p/11966722.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!