OSDN Git Service

Regular updates
[twpd/master.git] / osx.md
1 ---
2 title: OS X
3 layout: 2017/sheet
4 category: macOS
5 ---
6
7 ### Locations of startup items
8
9     ~/Library/LaunchAgents
10     /System/Library/LaunchAgents/
11     /System/Library/LaunchDaemons/
12     /Library/LaunchAgents/
13     /Library/LaunchDaemons/
14
15     __Running `launchctl list` show you what launch scripts are currently loaded.__
16
17 ### Hide desktop icons
18
19     defaults write com.apple.finder CreateDesktop -bool false
20     killall Finder
21
22 ### Auto-hide other windows on dock switch
23
24     defaults write com.apple.dock single-app -bool TRUE
25     killall Dock
26
27     defaults delete com.apple.dock single-app
28     killall Dock
29
30 ### Flush DNS
31
32     killall -HUP mDNSResponder   # 10.8+
33     dscacheutil -flushcache      # 10.7 below
34
35 ### Disable spotlight indexing
36
37     mdutil -a -i off                    # disable indexing for all volumes
38     mdutil -i off MOUNT_POINT           # disable for specific volume
39     touch FOLDER/.metadata_never_index  # disable for FOLDER
40                                         
41
42 ### Turn on/off proxy
43
44     sudo networksetup -setsocksfirewallproxystate Wi-Fi off
45     sudo networksetup -setsocksfirewallproxystate Ethernet off
46     sudo networksetup -setsocksfirewallproxy Wi-Fi 127.0.0.1 9999
47     sudo networksetup -setsocksfirewallproxy Ethernet 127.0.0.1 9999
48     sudo networksetup -setsocksfirewallproxystate Wi-Fi on
49     sudo networksetup -setsocksfirewallproxystate Ethernet on
50
51 ### System utils
52
53  - `networksetup` - Configure network (ip, dns, proxy, etc)
54  - `tmutil` - Configure Time Machine (enable/disable, exclude path, delete snapshots, etc)
55  - `mdutil` - Manage Spotlight (enable/disable, exclude, etc)
56  - `diskutil` - Control disk (format, eject, unmount, etc)
57  - `launchctl` - Control running "agents"
58
59 ### Useful utils
60
61  - `open` - open files and directories ([man](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/open.1.html))
62  - `textutil` - manipulate text files of various formats ([man](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/textutil.1.html))
63  - `pbcopy` / `pbpaste` - provide copying and pasting to the pasteboard ([man](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/pbcopy.1.html))
64  - `sips` - scriptable image processing system ([man](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/sips.1.html))
65  - `mdfind` - finds files matching a given query ([man](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/mdfind.1.html))
66  - `screencapture` - capture images from the screen ([man](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/screencapture.1.html))
67  - `defaults` - access the Mac OS X user defaults system ([man](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/defaults.1.html))
68  - `/usr/libexec/airportd`
69  - `scutil`
70
71  __INFO: `brew` ([link](https://brew.sh)) is highly recommended utility__