Macbook Pro上手手札

来源:互联网 发布:mac idea 常用快捷键 编辑:程序博客网 时间:2024/06/05 02:56

(更新时间:2016-11-25 10:37)

Macbook Pro上手手札


Mac OS X必备软件

MacOS系统重装by U盘



多肉镇楼!








Finder里面的文件自动排列:

(1/2)


(2/2)排列方式选择为种类,然后最下面“用作默认”






问题集(答案在下面,建议页面内搜索。   陆续添加的内容在文章最下面)

2016-09-07

1.如何分割Dock空间? (在APP图标之间,添加空白位置作为分割线)



Before:

1.如何关闭OS X Yosemite的输入法的自动纠正-“自动纠正拼写”。
2.解决Mac终端exit不能主动退出。
3.Scroll Reverser – 逆向滚轮[Mac] -鼠标滚轮,触摸板方向。
4.gfxCardStatus 2.2.1 - 显卡切换,强制使用集成显卡,Macbook显卡门。
5.光标移动速度很慢。
6.快捷键 - safari
新建标签页: 花键+T
地址栏全选: 花键+L

7.Safari关闭右侧标签页,插件 - 模仿Chrome,关闭右边标

8.Safari必备插件

  • 重命名文件/文件夹
  • 打开文件夹
  • 返回上一级
  • 鼠标右键
  • 右键新建文本文件,新建txt
  • 在任何界面进行选中单词翻译,或预览链接
  • mac当前文件夹右键添加打开终端并定位到此文件夹
  • Mac OS X 启动项添加.sh脚本 (没有成功运行)
  • 怎么把pro睡眠唤醒时的登陆密码去掉

1.关闭Mac屏幕
2.快捷键切换 “自动显示和隐藏 Dock”
3.让Dock自动 显示/隐藏 不再有延迟
4.Parallels Desktop可以安装安卓模拟器4.4.0

题外话:

1. 屏幕百度首页的“hao123”链接





================ 答案 ==================

1.如何分割Dock空间? (在APP图标之间,添加空白位置作为分割线)

defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'killall Dock
从:


到:


参考自:http://www.macgg.com/archives/3778.html




重命名文件/文件夹 (Windows下按F2)
1.选中,直接Enter
2.或点击名字

打开文件夹(Windows下直接Enter)
花键+O

返回上一级目录(WIndows下直接Delete键)
花键+Up

类似windows上的鼠标右键
1.光标停好,在触摸板上双指轻点即可,要同时点
2.或者用外接鼠标右键

在任何界面进行选中单词翻译,或预览链接
1.安装好有道词典
2.选中文字(必须是可以选中的)
3.在触摸板上 三指轻按即可


右键新建文本文件,新建txt
http://osx86.cn/mac-os-x-new-text-file.html



mac当前文件夹右键添加打开终端并定位到此文件夹
http://www.crifan.com/mac_right_click_folder_open_terminal_locate_to_that_path/



Mac OS X 启动项添加.sh脚本 没有成功运行!
1)建好.sh文件
2)新增/Library/LaunchDaemons/com.anyname.plist

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0">    <dict>        <key>Label</key>        <string>com.anynamehere.app</string>        <key>ProgramArguments</key>        <array>            <string>/bin/sh/string>            <string>/path/to/your/sh/script/name.sh</string>        </array>        <key>RunAtLoad</key>        <true/>        <key>KeepAlive</key>        <false/>    </dict></plist>

3)或者,在系统设置中添加启动项:
系统偏好设置-用户与群组-登陆项-添加程序








怎么把pro睡眠唤醒时的登陆密码去掉?
http://www.macx.cn/thread-2076131-1-1.html
系统偏好设置 安全性与隐私  通用 去掉进入睡眠或开始屏幕保护程序 勾选



=======================
如何关闭OS X Yosemite的自动纠正

步骤1:系统偏好设置。
步骤2:语言与地区,键盘,键盘偏好设置。
步骤3:点击窗口顶部的“文本”标签,然后取消“自动纠正拼写”一栏的勾选。




====  DAY4 =====
2)解决Mac终端退出时的不爽(不能自动退出exit)
http://droidyue.com/blog/2014/07/13/mac-terminal-exit-troubleshoot/

3)Scroll Reverser – 逆向滚轮[Mac] -鼠标滚轮,触摸板方向
http://pilotmoon.com/scrollreverser/


4) gfxCardStatus 2.2.1 - 显卡切换,强制使用集成显卡,Macbook显卡门
http://bbs.feng.com/read-htm-tid-5161253.html

5) Mac 下光标移动速度很慢 - 终端 移动 位置
http://www.zhihu.com/question/20849024
打开你 Mac 的系统偏好设置 -> 选择键盘 -> 将按键重复拉到最右


6) 快捷键 - safari
新建标签页: 花键+T
地址栏全选: 花键+L


7) Safari关闭右侧标签页,插件 - 模仿Chrome,关闭右边标签
http://safariaddons.com/en-US/safari/addon/124

8)Safari必备插件

  1. Safari全屏查看网页代码,新建Tab标签页来显示sourcecode源代码 (无需借助“检查元素”)       SourceViewer
  2. Safari关闭右侧标签页,关闭右边标签(其实是上面的第7点)   Close Left/Right Tabs 1.0.0.0
  3. Safari广告终结者   Adblock Plus



题外话:

屏幕百度首页的“hao123”链接

参考自 http://jingyan.baidu.com/article/4853e1e579176c1909f7261e.html

(里面有不足的地方,它同时会屏蔽其他链接,如地图、知道等,下面是改进的方法)

1. 浏览器上安装插件,adblock之类的,具体百度

2. 点击adblock之类的按钮,设置,“自定义过滤”,新建一个规则,内容如下:

baidu.com##.mnav[href='http://www.hao123.com']

3. 保存, 刷新百度

----简单解释:屏蔽网址为baidu.com的页面上的一个元素,这个元素class名是mnav,另外其href属性为http://www.hao123.com






关闭Mac屏幕

1.直接使用F1键调低亮度,直至全黑

2.或者【Control】+【Shift】+【键盘右上角(光驱弹出)按键】就可以快速关闭Mac屏幕




让Dock自动 显示/隐藏 不再有延迟
defaults write com.apple.Dock autohide-delay -float 0 && killall Dock

恢复原来默认的延迟速度

defaults delete com.apple.Dock autohide-delay && killall Dock

快捷键切换 “自动显示和隐藏 Dock”
option + command + D




超级爽的隐藏的程序切换效果
ctrl+Shift+方向上 
ctrl+Shift+方向下


Eclipse搜索,替换
花键+F (Ctrl+F)




[很好用]安卓模拟器 - 海马玩

下载地址:http://droid4x.haimawan.com

缺点:不能在最新的10.12中正常运行



[感觉不好用]Parallels Desktop可以安装安卓模拟器4.4.0

1)点击右上角加号,新建新的模拟器
2)选择下方的“安卓”, 配合VPN,自动下载安装安卓模拟器
3)启动Android,安装“Orientation Control”强制指定屏幕旋转方向。 
http://www.coolapk.com/apk/com.coinsoft.android.orientcontrol








换内存后,Netbeans在Mac下奔溃!
1)要么升级Mac里面的JDK的版本,一切迎刃而解
2)要么手动配置内存使用for JDK,参考:
http://blog.csdn.net/lu1024188315/article/details/51885892
http://www.lirongzhen.cn/?p=1194
http://blog.sina.com.cn/s/blog_6f8300990102v279.html





查询单个库中所有表磁盘占用大小的SQL语句:

select TABLE_NAME,concat(data_length/1024/1024,' MB') as data_size from information_schema.tables where TABLE_SCHEMA = 'xxxxxxxxxxxxxxxxx' order by data_size DESC;

(要将xxxxxxxxx修改成目标数据库名字)



查询所有数据库占用磁盘空间大小的SQL语句(报错)
select TABLE_SCHEMA, concat(truncate(sum(data_length)/1024/1024,2),' MB') as data_size,
concat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size
from information_schema.tables
group by TABLE_SCHEMA
order by data_length desc;


查询单个库中所有表磁盘占用大小的SQL语句:(报错)
select TABLE_NAME, concat(truncate(data_length/1024/1024,2),' MB') as data_size,
concat(truncate(index_length/1024/1024,2),' MB') as index_size
from information_schema.tables where TABLE_SCHEMA = ‘NameOfTestDB'
group by TABLE_NAME
order by data_length desc;
=== 注意要修改以上的NameOfTestDB ===










Linux查看内存使用情况
free -m


Linux内存使用前十名
ps aux|head -1;ps aux|grep -v PID|sort -rn -k +4|head
(那个4变成3的话,就是看CPU)


批量删除所有带Firefox的进程
ps aux | grep 'firefox' | grep -v 'grep' | awk '{print $2}' |xargs kill -9




Linux crontab定时执行任务 命令格式与详细例子
http://www.jb51.net/LINUXjishu/19905.html













====  DAY1 =====

Mac os 10.11下安装apache2.4 + PHP 

http://blog.sina.com.cn/s/blog_6b18d4480101m5vn.html
其中,有错误:
cd /etc/apache/extra
-bash: cd: /etc/apache/extra: No such file or directory
找不到这个目录,需要改成apache2cd /etc/apache2/extra

涉及到:
/etc/hosts
/etc/php.ini
/etc/apache2/httpd.conf
/etc/apache2/users/rudon.conf  ---- 自己的用户名.conf
/etc/apache2/extra/httpd-vhosts.conf


修改/etc/apache2/httpd.conf
<Directory /> Options Indexes FollowSymLinks MultiViews AllowOverride None Order deny,allow Allow from all </Directory> 





安装MySQL:

1.官网下载安装包:  http://dev.mysql.com/downloads/mysql/  (会自动选择对应的OSX的版本)

2.安装,注意过程中会弹出小框提示,告诉你目前的root的登录密码,注意保留。

3.添加环境变量:sudo vi /etc/profile,添加:export PATH=$PATH:/usr/local/mysql/bin  完了之后重启命令行可以使用mysql命令

4.设置root密码,登陆进去后SET PASSWORD = PASSWORD('123456');  或者忘记了密码请参考 http://www.euryugasaki.com/archives/853

5.如果项目报warning的话,在终端输入以下命令:

cd /var mkdir mysqlcd mysqlln -s /tmp/mysql.sock mysql.sock

报错例子:PHP Warning:  mysql_select_db(): No such file or directory in 

5 如果还是链接不了? http://www.mamicode.com/info-detail-516543.html




修改Mysql的root默认密码:
You must reset your password using ALTER USER statement before executing this statement.
RudondeMacBook-Pro:~ rudon$ mysql -uroot -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 5Server version: 5.7.16Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.mysql> SET PASSWORD = PASSWORD('123456');Query OK, 0 rows affected, 1 warning (0.01 sec)mysql> show databases;+--------------------+| Database           |+--------------------+| information_schema || mysql              || performance_schema || sys                |+--------------------+4 rows in set (0.02 sec)
Mysql官网的解决办法:How to Reset the Root Password
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
Mysql初始化root密码和允许远程访问


sudo /usr/local/mysql/support-files/mysql.server start 
sudo /usr/local/mysql/support-files/mysql.server stop




給Mac添加wget功能
http://www.mactricksandtips.com/2008/07/installing-wget-on-your-mac-for-terminal.html


GD库缺少freeType支持
http://www.cleey.com/blog/single/id/831.html









====  DAY2 =====

ssh scp 免密码

ssh-keygen -t rsa -C "your@email.com"
Too many arguments
解决办法:ssh-keygen -t rsa 然后一路enter
cd
cd .ssh/
cat id_rsa.pub
复制
用密码登陆到服务器之后,echo '刚才复制的内容' >> ~/.ssh/authorized_keys
搞定




======= 后续添加的 =======

Mac键盘图标与对应快捷按键
⌘——Command ()
⌃ ——Control
⌥——Option (alt)
⇧——Shift
⇪——Caps Lock
fn——功能键就是fn








寻找最简单的记事本
Chocolat for Mac破解版  : 

http://www.orsoon.com/Mac/129835.html




Sublime Text 2
http://www.sublimetext.com/2


Eclispse 换主题、皮肤、配色,换黑色主题护眼
http://jingyan.baidu.com/article/6c67b1d68c03be2787bb1ed6.html


Eclipse Java EE中安装 Emmet (Zend Coding) 需要注意的地方
http://blog.csdn.net/cmalaya/article/details/39230843


Redis图形化管理
http://download.csdn.net/download/u010899197/8869633




Redis删除所有的key
redis-cli keys "*" | xargs redis-cli del
参考自http://ssuupv.blog.163.com/blog/static/1461567220135610456193/






  截图  

自选区域:花键+shift+4,保存到桌面
全屏:       花键+shift+3,保存到桌面


[QQ截图,微信截图]
花键+Control+A,复制到剪切板



系统启用Blew (需要VPN好像)
0) 安装xcode之类的库,好像一百多MB:
xcode-select --install
1) curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C/usr/local --strip 1
2) sudo -i
3) brew update
4) 或者参考http://snowolf.iteye.com/blog/774312




PHP启用phpize

[错误提示 Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.]
1) brew install autoconf   (有错误?看下面一点)
2) 
报错(无法写入文件到/usr/local):

RudondeMacBook-Pro:phpredis-phpredis-b718ce0 rudon$ brew install autoconfError: /usr/local is not writable. You should change theownership and permissions of /usr/local back to youruser account:  sudo chown -R $(whoami) /usr/localfatal: could not create leading directories of '/usr/local/Library/Taps/homebrew/homebrew-core': Permission deniedError: Failure while executing: git clone https://github.com/Homebrew/homebrew-core /usr/local/Library/Taps/homebrew/homebrew-core --depth=1 -qError: Failure while executing: /usr/local/bin/brew tap homebrew/core -qRudondeMacBook-Pro:phpredis-phpredis-b718ce0 rudon$ sudo brew install autoconfError: Running Homebrew as root is extremely dangerous and no longer supported.As Homebrew does not drop privileges on installation you would be giving allbuild scripts full access to your system.
此问题类似于 这个:

装不了PHP的扩展,make install失败RudonMacBook:igbinary-master rudon$ make installInstalling shared extensions:     /usr/lib/php/extensions/no-debug-non-zts-20131226/cp: /usr/lib/php/extensions/no-debug-non-zts-20131226/#INST@12567#: Operation not permittedmake: *** [install-modules] Error 1cp: /usr/lib/php/extensions/no-debug-non-zts-20121212/#INST@17000#: Operation not permitted

解决办法:macOS Sierra或者OS X EI Capitan安装PHP扩展出错,Operation not permitted, no-debug-non-zts







Mac OS X安装Redis,并设置开机启动

1. 下载最新版的Redis安装包 ,http://redis.io/download   -> redis-3.2.5.tar

2. 命令行:

tar xzf redis-3.2.5.tarmv redis-3.2.5 rediscd redismakesudo make install
3. 设置随系统启动
sudo vi /Library/LaunchDaemons/io.redis.redis-server.plist
4. 粘贴,保存:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict>  <key>Label</key>  <string>io.redis.redis-server</string>  <key>ProgramArguments</key>  <array><string>/usr/local/bin/redis-server</string><string>/usr/local/etc/redis.conf</string>  </array>  <key>RunAtLoad</key><true/> </dict></plist>
5. 使用launchctl设置开机自动启动:

sudo launchctl load /Library/LaunchDaemons/io.redis.redis-server.plist

6. 使用launchctl启动redis server
sudo launchctl start io.redis.redis-server
7. 使用launchctl停止redis server

sudo launchctl stop io.redis.redis-server
这个方法来自:https://my.oschina.net/jackieyeah/blog/524583





 Install PHP-Redis 

1) wget http://github.com/nicolasff/phpredis/tarball/master -O phpredis.tar.gz
2) tar xzvf phpredis.tar.gz
3) cd nicolasff-phpredis-f1231c9
4) phpize
5) ./configure
6) make
7) sudo make install
8) nano /etc/php.ini
9) 在最后插入extension=redis.so
10)sudo apachectl restart








Linux之间同步文件

brew install rsync
sudo apt-get install rsync
ssh someone@IP
rsync -az someone@ip:path/to/origin/files/ /path/of/local/path/to/save/









0 0