###Useful OS X commands
-
App Store Debug menu
Show
defaults write com.apple.appstore ShowDebugMenu -bool true
Hide
defaults write com.apple.appstore ShowDebugMenu -bool false
-
Remove extended attributes recursively
xattr -rc <Folder>
-
Delete Time Machine backups
sudo /System/Library/Extensions/TMSafetyNet.kext/Helpers/bypass rm -rfv /Volumes/<Disk>/Backups.backupdb/<Folder>/
-
Carbon copy a physical disk to an image (.dmg) file
source: http://hints.macworld.com/article.php?story=20050302225659382dd bs=4096 if=/dev/rXX# of=/[TARGET DIR]/image.dmg conv=noerror,sync
You have to dismount the partition first.
Use thediskutil list
andmount
commands to discover the devices. -
Convert .png images to .jpg
sips -s format jpeg ./*.png --out jpg/
-
Resample image
sips <source image> --resampleHeight <number> --out <directory>
-
Finder Error -10810
http://www.thexlab.com/faqs/error-10810.html
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -seed -rfv
-
Query locked files
lsof +c 0 | grep "\.Trash"
-
Flush and Reset All DNS Caches in OS X 10.10+
via http://osxdaily.com/2014/11/20/flush-dns-cache-mac-os-x/
From OS X 10.10.4 moving onward, including 10.11, Apple has ditched discoveryd and has replaced it (or rather, reverted back to) mDNSResponder. Thus, to clear DNS caches in OS X Yosemite 10.10.4, and 10.11 El Capitan, and presumably onward, the command string is as follows:sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder;say cache flushed
That command flushes all DNS caches for OS X 10.10.4+.
-
Detailed Wi-Fi Connection History
OS X Yosemite 10.10 and newer:
defaults read /Library/Preferences/SystemConfiguration/com.apple.airport.preferences |grep LastConnected -A 7
-
How to Repair Disk Permissions in OS X El Capitan from Command Line
via: http://osxdaily.com/2015/11/04/verify-repair-permissions-mac-os-x/
sudo /usr/libexec/repair_packages --repair --standard-pkgs --volume /
-
Configuring Split Tunnel for VPN
via: https://documentation.meraki.com/MX-Z/Client_VPN/Configuring_Split-tunnel_Client_VPN
First, disable full tunnel (all traffic over the VPN):
- Navigate to the specific VPN settings for OS X, located under System Preferences > Network.
- Click Advanced Settings
- Under "Options" section, deselect “Send all traffic over VPN”
Add a new route to local routing table:
- Connect to the Client VPN
- Open the Terminal Application; normally this is located in Applications > Utilities > Terminal
- Verify the PPP interface that is being used for the Client VPN, this can be done by typing
ifconfig
- As a superuser, enter the following command, replacing the relevant information between the <> markings: Note: "Destination subnet" refers to the local LAN subnet on the appliance's site, not the Client VPN subnet specified in Dashboard.
Route add -net <destination subnet>/<subnet mask in CIDR notation> -interface <VPN interface>
Example: sudo route add 10.0.1.0/24 –interface ppp0
To verify that the route was added take a look at the routing table, the new subnet should now have an entry. The route table can be accessed by typing netstat -r
.
The route table will have to be modified depending on what networks will be accessed over the Client VPN (e.g. more than one network behind the concentrator). The interface will also have to be modified if there is more than one VPN configured on the client.
"/System/Library/Extensions/TMSafetyNet.kext/Helpers/bypass" should be "/System/Library/Extensions/TMSafetyNet.kext/Contents/Helpers/bypass".