Mac新手配置记录 - 开发环境诉求
1 Software Install
1.1 Editor
自己编译安装,或使用brew安装的Emacs,没有对应的Application链接。直接安装 EmacsForMacOSX(https://emacsformacosx.com/)版本。
1.2 Homebrew
包管理器维护一系列工具软件,自动处理其安装、移除、依赖、升级、配置等事项,降低操作系统维护难度。例如GNU/Linux发行版Debian的apt。
Apple没有给MacOS开发包管理器。brew是三方开发的MacOS包管理器,相关网址在这里:
执行如下指令安装:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
1.2.1 list
brew install global cmake wget
2 Conventient Config
2.1 Defualts Shortcuts
2.2 Customize Shortcuts
日常使用的软件,习惯于用一个快捷键启动。MacOS Keyboard定制的,按照如下教程创建一个快捷键:
- Using Automator
First, we need to create an Automator service that, when prompted, will open our selected application.
Open Automator. It can be found in the Applications folder, accessible by selecting Go then Applications in the Finder menu or by using the keyboard shortcut Shift Command A.
If this is your first time in Automator, you should be presented by an initial window offering to start a new document, though if it doesn't appear, select File then New in the menu to start from scratch. At this point, select Service then the Choose button.
In the top section starting "Service receives," set the dropdown box to "no input," and check to make sure the second dropdown is set to "any application."
Click Actions in the top-right corner, scroll down the list of actions in the second column to find Launch Application, and drag it into the main workflow box to the right. This will add a new Launch Application section to the workflow box.
Select the application(second coloumn) you want to open from the shortcut using the Launch Application dropdown box.
Select File then Save in the menu, enter an appropriate name for the command, and click Save. Close Automator.
- Creating the shortcut
Select the Apple logo in the Menu, and select System Preferences then the Keyboard icon in the second row. Select the Shortcuts tab, which should be in the middle of the five tabs near the top of the window.
Select Services in the left-hand column, then scroll down to the service with the same name as the command created in Automator. If the side tick isn't visible, click it before clicking the command, then click the Add Shortcut button that appears.
At this point, select the key combination you want to use to open the selected application and press the buttons at the same time. If macOS accepts the combination, it will then show the keyboard combination in the listing.
Close the System Preferences window and test out the keyboard command.
- Further Thoughts
While this tip largely centers around opening an app, the same principles can be used to create keyboard shortcuts to do a multitude of tasks. If a sequence of events is set up in Automator and saved as a service, it can be assigned a keyboard shortcut, and could be used to perform multi-stage tasks with a single collective key press.
Also, be aware of setting a keyboard shortcut that may duplicate one that is already in use by another system function or app, in case they conflict with each other or fail to perform an action at all. The last thing you want is to go to the trouble of setting up a key combination that ultimately doesn't do what you want.
2.3 Move alt-command dock(menu) bar to external display
- Open: Apple->System Preferences…->Displays->Arrangement Drag top white bar from builtin display to external display
- PS: you can arrange dependent position here
3 Developer Tools
3.1 terminal
3.1.1 iterm2
3.1.2 tmux2
4 FAQ
4.1 Update Problem xcrun: error: invalid active developer path, missing xcrun
After Update MAC os, Compile(e.g. make) error:
MacBook-Pro-3:perfbook yanyg$ make xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun'
Exec command:
xcode-select --install
Exec follow if problem still exist:
xcode-select -switch /