mac环境汇总

安装brew

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

解决OSX 10.13 High Sierra brew update问题

//先卸载homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
//再次安装:

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

官网下载安装iterm2
运行如下命令安装oh-my-zsh:

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

更换zsh主题配色:

git clone https://github.com/dracula/zsh.git
ln -s $DRACULA_THEME/dracula.zsh-theme $OH_MY_ZSH/themes/dracula.zsh-theme
mv ~/Downloads/zsh-master/dracula.zsh-theme ~/.oh-my-zsh/themes
vim .zshrc
ZSH_THEME="dracula"

安装zsh-autosuggestions自动补全功能:

git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
vim .zshrc
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh   #自动补全

安装vim语法高亮插件:

brew install vim
#添加下面三行到.zshrc
export PATH="/usr/local/opt/ruby/bin:$PATH"
export CPPFLAGS="-I/usr/local/opt/ruby/include"
export LDFLAGS="-L/usr/local/opt/ruby/lib"

安装powerline:

sudo easy_install pip
pip install powerline-status --user
   配置.zshrc文件,添加:
brew install zsh-syntax-highlighting
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source ~/.zshrc

安装fzf

# for Mac
# install fd & fzf
$ brew install fd fzf
​
# bind default key-binding
$ /usr/local/opt/fzf/install
$ source ~/.zshrc
​
# alter filefind to fd
$ vim ~/.zshrc
export FZF_DEFAULT_COMMAND='fd --type file'
export FZF_CTRL_T_COMMAND=$FZF_DEFAULT_COMMAND
export FZF_ALT_C_COMMAND="fd -t d . "
​
$ source ~/.zshrc
​
# Ctrl+R History command; Ctrl+R file catalog
# if you want to DIY key of like 'Atl + C'
# maybe line-num is not 66, but must nearby
$ vim /usr/local/opt/fzf/shell/key-bindings.zsh
- 66 bindkey '\ec' fzf-cd-widget
+ 66 bindkey '^\' fzf-cd-widget
​
$ source /usr/local/opt/fzf/shell/key-bindings.zsh

配置sublime

{
    "auto_find_in_selection": true,
    "bold_folder_labels": true,
    "color_scheme": "Packages/Color Scheme - Default/Mariana.sublime-color-scheme",
    "default_line_ending": "unix",
    "dpi_scale": 1.0,
    "draw_minimap_border": true,
    "ensure_newline_at_eof_on_save": true,
    "fade_fold_buttons": false,
    "font_face": "Microsoft YaHei Mono",
    "font_size": 13,
    "highlight_line": true,
    "highlight_modified_tabs": true,
    "ignored_packages":
    [
        "SublimeTmpl",
        "Vintage"
    ],
    "save_on_focus_lost": true,
    "theme": "Default.sublime-theme",
    "translate_tabs_to_spaces": true,
    "trim_automatic_white_space": true,
    "trim_trailing_white_space_on_save": true,
    "update_check": false,
    "word_wrap": "true"
}

sublime text3汉化方法:

cd /Users/kim/Library/Application Support/Sublime Text 3/Packages
git clone -b st3 https://github.com/rexdf/ChineseLocalization.git ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/ChineseLocalization
#重启sublime

配置vim配色
安装Vim(系统自带的Vim不是最新版)

& brew install wget

建立并编辑配置文件 (不使用任何插件情况下一些有用的配置)

cd ~
vim .vimrc

编辑配置文件为:

 " 当前行高亮
au WinLeave * set nocursorline nocursorcolumn
au WinEnter * set cursorline
set cursorline

colorscheme default       " 颜色主题
​
syntax enable                 " 启用语法分析着色

set tabstop=4                  " 设定Tab表示的空格数
set softtabstop=4            " 设定输入Tab表示的空格数
set expandtab                 " 将Tab视为若干空格
set backspace=2            " 设置退格键可用

set number                      " 显示行号
set showcmd                   " 右下角显示待补全命令

set hlsearch                     " 搜索字符串时高亮所有结果,:nohlsearch取消高亮

安装Vundle(Vim 插件管理器)

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

在配置文件.vimrc开头添加如下配置:

"---START OF VUNDLE---
set nocompatible
filetype off

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
" Plugins start

" Plugins end
call vundle#end()
filetype plugin indent on
" ---END OF VUNDLE---

下载molokai主题,用Vundle安装颜色主题molokai,在配置文件中加入:

Plugin 'tomasr/molokai'
#在配置文件中colorscheme default一行改为:
colorscheme molokai

mac下安装laradock
进入系统根目录下载laradock:

~ (master) ✗ git submodule add https://github.com/Laradock/laradock.git laradock
正克隆到 '/Users/kim/laradock'...
remote: Enumerating objects: 8397, done.
remote: Total 8397 (delta 0), reused 0 (delta 0), pack-reused 8397
接收对象中: 100% (8397/8397), 7.98 MiB | 36.00 KiB/s, 完成.
处理 delta 中: 100% (4429/4429), 完成.~ (master)

进入laradock目录执行:

~ (master) ✗ cd laradock
➜  laradock (master) ✔ cp env-example .env
➜  laradock (master)

编辑.env文件并修改APP_CODE_PATH_HOST参数为:

vim .env
#此处为与.env文件的相对目录
APP_CODE_PATH_HOST=../cimer/
#退出并保存

laradock下执行以下命令启动服务:

docker-compose up -d nginx mysql
···········
Creating laradock_mysql_1            ... done
Creating laradock_docker-in-docker_1 ... done
Creating laradock_workspace_1        ... done
Creating laradock_php-fpm_1          ... done
Creating laradock_nginx_1            ... done
➜  laradock (master) ✔ docker-compose ps
           Name                          Command              State               Ports
----------------------------------------------------------------------------------------------------
laradock_docker-in-docker_1   dockerd-entrypoint.sh           Up      2375/tcp
laradock_mysql_1              docker-entrypoint.sh mysqld     Up      0.0.0.0:3306->3306/tcp,
                                                                      33060/tcp
laradock_nginx_1              /bin/bash /opt/startup.sh       Up      0.0.0.0:443->443/tcp,
                                                                      0.0.0.0:80->80/tcp
laradock_php-fpm_1            docker-php-entrypoint php-fpm   Up      9000/tcp
laradock_workspace_1          /sbin/my_init

如果你使用的是mysql,需要在.env文件添加一行:

DB_HOST=mysql

授权mysql外部链接并修改密码:

laradock (master) ✗ docker-compose exec mysql bash
root@511290b34517:/# mysql -uroot -proot
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
#修改密码
mysql> update user set authentication_string=PASSWORD("1q2w3e4r") where User = 'root';
Query OK, 2 rows affected, 1 warning (0.01 sec)
Rows matched: 2  Changed: 2  Warnings: 1
#外部授权
mysql> grant all privileges on *.* to 'root'@'localhost' identified by '1q2w3e4r' with grant option;
Query OK, 0 rows affected, 2 warnings (0.01 sec)
​
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> exit
Bye

  转载请注明: 金鱼博客 mac环境汇总

 上一篇
There are no packages available for installation问题 There are no packages available for installation问题
解决sublime text 3使用Install Package时出现There are no packages available for installation问题。 分析原因发现: 在利用sublime进行插件下载时,sub
2019-03-18
下一篇 
wordpress高亮解决方案 wordpress高亮解决方案
虽然wordpress有很多插件可以使页面代码高亮展示,但我还是喜欢 Prism ,Prism支持包括C,Java,CSS,HTML,PHP等所有流行语言,且使用简单,下载文件后引入文件即可使用,下面介绍下wordpress中如何使用Pri
2019-03-18
  目录