---
title: "Mac 常用设置"
author: "Luob."
date: "2019-02-19T13:03:47Z"
tags: []
categories: ["操作系统"]
slug: "mac"
draft: false
lastmod: "2020-02-10T11:17:57Z"
id: 2437328
url: "https://takeme.iteye.com/blog/2437328"
---

```java

使用U盘制作 Mac 系统
https://segmentfault.com/a/1190000015806408

先格式化U盘 然后 在命令行中输入
下面的命令 
sudo /Applications/Install\ macOS\ Mojave\ Beta.app/Contents/Resources/createinstallmedia --volume /Volumes/mojave --applicationpath /Applications/Install\ macOS\ Mojave\ Beta.app --nointeraction

```


mac系统如何处理来自身份不明的开发者
打开终端（终端在 应用程序 -> 实用工具 内）

```java

sudo spctl --master-disable

```


brew 的安装 

```java

https://brew.sh/index_zh-cn

命令行 输入如下 命令 进行
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

高坂本系统 安装低版本jdk

brew tap caskroom/versions
brew cask install java8

```


navicat 破 解

```java

https://blog.csdn.net/xhd731568849/article/details/79751188

```


SSH脚本自动登录

```java

先安装
brew install expect
brew install spawn-fcgi

然后新建 login.sh

#!/usr/bin/expect
spawn ssh -i /Users/luobin/Downloads/id_rsa  $user@$ipaddress
expect {
        "*password:" { send "$password\r" }
        "yes/no" { send "yes\r;exp_continue" }
}
interact


```



mac 链接window 共享

```java


command+k   输入 smb://ip  点击链接


```


ll 命令 设置

```java

//新建 环境变了配置文件
vim  ~/.bash_profile

//在最后面加上以下代码保存

alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

//最后在终端输入,回车

source .bash_profile


```



修改 /var 权限

```java


sudo chown root:admin /var
sudo chown root:admin /var/log
sudo chmod g+w /var/log


```



修改hosts

```java

vi   /etc/hosts 
0.0.0.0         account.jetbrains.com

```


修改DNS

```java


networksetup -setdnsservers Wi-Fi empty

networksetup -setdnsservers Wi-Fi 10.1.1.1.


```


配置环境变了

```java

alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

export PATH=$PATH:/usr/local/Cellar/gradle-3.2.1/bin


source ~/.bash_profie

```




常用快捷键

```java

command +空格 打开程序搜索框
command+ tab 切换应用程序
command+q 切换应用程序后 退出
shift+command+q 锁屏
shift+command+5 截屏
option+command+d 隐藏程序栏坞


command+k 打开远程连接
command+f3  显示桌面
option+esc+command 打开强制退出程序框
shift+command+D 打开电脑文件夹


control+command+f  窗口 放大缩小
command+m 最小化当前窗口


command+n  新建一个窗口
command+f 查找
command+w  关闭浏览器当前页
shift+command+n 进入无痕模式
command+, 打开设置
option+command+c或者i 打开开发者调试模式


空格键  快速看下一页
command+x 剪切
command+cv 复制粘贴
command+a 全选
command+z 撤销上一步的操作

shift+command+n 新建一个文件夹
command+delete 删除 
command+E  推出宗卷


```


terminal 换行覆盖问题

```java

1）配置文件：vim ~/.bash_profile

PS1="\[\e[0;31m\] \u@\h \W\$ \[\e[m\] "

//ls 命令添加颜色
  alias ll='ls -alF'
  alias la='ls -A'
  alias l='ls -CF'
  
  export PATH=$PATH:/usr/local/Cellar/gradle-3.2.1/bin
  
 export LS_OPTIONS='--color=auto'
 export CLICOLOR='Yes'



source ~/.bash_profile

```
 
<https://www.jianshu.com/p/e1d88647e4f1>


设置vim 背景颜色

```java

// 复制系统的 .vimrc 配置到当前用户  然后修改配置

cp -r /usr/share/vim/vimrc ~/.vimrc

vim  ~/.vimrc

添加
syntax on
set nu!
set autoindent

保存退出



```
 

//取消系统 智能ABC 输入法


```java

//1 下载 plistEdit pro  软件
https://www.fatcatsoftware.com/plisteditpro/PlistEditPro.zip
打开 PlistEditPro 

sudo open ~/Library/Preferences/com.apple.HIToolbox.plist

依次点开 Root - AppleEnabledInputSources ，会看到一列 item ，找到其中 KeyboardLayout Name 为 ABC 的那一列，将整列 item 删掉，然后 command + S 保存。


//参考  https://www.jianshu.com/p/0ba1292441b9 

```


//常用软件

```java

iTerm  类似  terminal  主要用来 进行  dump 文件的下载
ITerm 支持  rz  rs 命令 从服务器上传下载文件
https://www.iterm2.com/



Th unarchiver 软件  免费好用的解压软件  
https://theunarchiver.com/


```


ftp client 安装

```java

brew install telnet 
brew install inetutils 
brew link --overwrite inetutils

然后 打开 terminal  
连接ftp服务器

man ftp 可以看到有这些信息。

 NAME
      ftp -- Internet file transfer program
	
 SYNOPSIS
      ftp [-46aadefginprtvv] [-n netrc] [-o output] [-p port] [-q quittime]
          [-s srcaddr] [-r retry] [-t dir,max[,inc]] [[user@]host [port]]
          [[user@]host:[path][/]] [file:///path]
          [ftp://[user[:password]@]host[:port]/path[/][;type=X]]
          [http://[user[:password]@]host[:port]/path] [...]
      ftp -u URL file [...]
连接服务器的话基本上就用到上面的讯息了。原本没有看man手册，一直使用

 ftp user@xxx.com port
每次都要输入密码。后来还是用了下面这个更加简单的

 ftp ftp://user:passwd@xxx.com:port
浏览文件

命令和Windows、Linux的命令基本相同

 ftp> cd Documents
 ftp> ls		
 ftp> dir
下载上传文件

 put filename - Upload a file to the server
	
 get filename - Download a file from the server
	
 mput filename - Put multiple files on the server
	
 mget filename - Get multiple files on the server
断开连接

bye：中断与服务器的连接。

 ftp> bye
大部分的命令如下，可敲入man ftp获得

 ls – list the contents of a directory on the FTP server
 cd – change the working directory on the FTP server
 pwd – show the current directory on the FTP server
 get – download files from the FTP server
 put – upload files to the FTP server
 account – include a password with your login information
 bye – terminate an ftp session and close ftp (or use disconnect to simply terminate a session)
 bell – make a cute sound after each file transfer is done
 chmod – change permissions
 delete – your guess is as good as mine (OK, you got me, it’s to delete a file off the server)
 glob – enable globbing
 hash – only functional in Amsterdam
 help – get help
 lpwd – print the local working directory for transfers
 mkdir – create folders on the FTP server
 rmdir – delete folders from the FTP server
 newer – only get a file if it’s newer (great for scripting synchronizations)
 nmap – use positional parameters to set filenames
 passive – use FTP passive mode
 prompt – allows the use of letters to automate answers to prompts
 rate – limit the speed of an upload or download
关于ftp，你甚至还可以写脚本进行文件操作，比如

	#!/bin/bash
	ftp -d krypted.com << ftpEnd
	prompt
	cd /Library/WebServer/Documents
	put “*.html”
	put “*.php”
	cd /Library/WebServer/Documents
	put “*.png”
	quit
	ftpEnd

	#!/bin/bash
	ftp -d krypted.com << ftpEnd
	prompt
	cd /My/Documents
	get “*.doc”
	quit
	ftpEnd
在你的脚本中，可以使用以下几个字符获取一些特定的变量：

%/ – the current working directory of the FTP server
%M – the hostname of the FTP server
%m – the hostname only up to the .
%n – the username used for the FTP server
最后有一个问题，为什么老是有不明的人/机器想登陆我的FTP？= =不过自己也是只有使用的时候才会开。  

```