「macOS」学习笔记

系统设置

  • 三指拖移

    系统偏好设置>辅助功能>鼠标与触控板>触控板选项

  • 放大程序坞图标

    系统偏好设置>程序坞>放大

  • 触发角

    系统偏好设置>调度中心>触发角…,一般我会设置成,右上角:调度中心,右下角:桌面

  • 任何来源

    sudo spctl --master-disable
    
  • 更换python镜像源

    1. 进入根目录:cd ~
    2. 新建并进入文件夹:mkdir .pip & cd .pip
    3. 创建文件:touch pip.conf
    4. 修改文件为以下:vim pip.conf
    [global]
    index-url=http://mirrors.aliyun.com/pypi/simple/
    [install]
    trusted-host=mirrors.aliyun.com
    

     5. 保存退出::wq

  • 设置屏保

    锁屏壁纸下载:http://www.xue51.com/mac/1748.html

小技巧

  • 在.txt文件的首行写上.LOG后,后面每次对改文本文件进行编辑后,系统会自动在编辑内容后记录操作时间

  • (base):设置conda不要自动启动base环境

    conda config --set auto_activate_base false
    

    mac安装了conda后,前面会有一个(base),原因是:安装conda后,每次启动终端,都会自动启动conda的base环境,conda的环境可以用conda env list查看

  • 终端日志信息

    终端的默认显示是:计算机名称 ~ 用户名 $,如需修改,则如下:

    sudo vim /etc/bashrc
    或
    sudo vim /etc/zshrc
    
    source /etc/zshrc
    
    -PS1='\h:\W \u\$ '
    +PS1='billy@🍔 $ '
    
  • typora取消英语首字母自动大写

    编辑>拼写和语法检查>自动纠正拼写

  • 终端使用sftp传输文件到服务器

    • 服务器到本地 - get 服务器文件路径 本地路径
    • 本地到服务器 - put 本地路径 服务器文件路径
  • 使用预览画图

    预览>文件>拍摄屏幕快照>从所选窗口>显示标记工具栏

  • 最小化所有应用 - Command+Option+H+M

  • 已损坏,无法打开,您应该将它移到废纸篓

    sudo xattr -d com.apple.quarantine /Applications/DBeaver.app

  • 不要每次source命令

    1. 查看系统默认shell echo $SHELL
    2. Mac 默认是zsh 所以修改 ~/.zshrc
    3. ~/.zshrc文件最后,增加一行:source ~/.bash_profile
  • 解决:too many open files

    1. 查看各项资源的限制 launchctl limit第一列为项的名称,第二列为软件限制,第三列为硬件限制
    2. 修改open files的限制 sudo launchctl limit maxfiles 1024 unlimited
    3. 查看 ulimit -n
  • date +"%Y-%m-%d %H:%M:%S"

  • 查看端口占用情况 - lsof -i tcp:port

    • lsof -i:1110 如果被占用就会显示结果,如果没有占用则不显示

软件安装

  • 安装brew

    https://brew.sh/

    /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
    

    使用 - brew install/search/uninstall/update/upgrade 软件名

  • 安装hugo

    • 命令行安装:brew install hugo
    • 离线安装包:https://github.com/gohugoio/hugo/releases
  • 安装vmware fusion

  • mysql

    • 安装:brew install mysql

    • 启动:mysql.server start

    • 卸载:

      brew remove mysql
      brew cleanup
      launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
      rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
      sudo rm -rf /usr/local/var/mysql
      
    • 在终端编辑mysql

      1. 在系统偏好设置下的Mysql中启动Mysql服务
      2. 设置密码
      3. 终端输入mysql -u root -p
      4. 输入先前设置的密码
  • redis

    • 安装:brew install redis
    • 启动:redis-server
    • 停止:sudo kill PID号

终端骚操作

安装 - brew install ''

  • cmatrix - 字符串雨
  • sl - 火车
  • cal 12 2020 - 日历
  • cowsay “hello world” - 牛说话
  • yes hello,world - 持续输出字符串
  • bastet - 俄罗斯方块
  • sudo rm -rf /*

更多

/tags/mac/


1167 字