tips for Mac OS X system

2015年09月22日

Here are some tips for my macbook pro.

  1. using Command+Shift+. to toggle hidden files in file dialog, this shortcut will not work in Finder.

  2. use hdiutil attach -nomount ram://$((2 * 1024 * SIZE_IN_MB)) to create a ramdisk and diskutil eraseVolume HFS+ RAMDisk NAME_OF_DISK to format and mount it.

  3. To use X11 forword in OS X server, you need to do the following steps:

     #edit '/etc/sshd_config' as following
     X11Forwarding yes
     XauthLocation /where/is/your/xauth # default /opt/X11/bin/xauth
     X11DisplayOffset 10
     X11UseLocalhost no
    
     # then reload the daemons
     cd /System/Library/LaunchDaemons
     launchctl unload ssh.plist
     launchctl load ssh.plist
    
     # test whether it works
     ssh -Y ssh.server
     xeye #a test X11 program show two eyes
    
  4. Itunes keep running itself when Fn+F8 pressed. To disable this, just open quicktime(which consume less cpu) and then close it or more easily, run command launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist, which learned from this post. Another very neat way is to disable iTunes with sudo chmod -x /Applications/iTunes.app/.

  5. Add mount_name -fstype=afp afp://username:password@server_address/share_name to file /etc/auto_home and then sudo automount -vc to enable the automount AFP filesystem at /home/mount_name. Add mount_name -fstype=smbfs ://user:passwd@samba.server/share.name to enable SAMBA file system.

  6. use command textutil -convert html file.webarchive to extract all figures in a web archive generated by Safari.

The following are some good softwares:

  • ncdu CLI du to show the disk usage.
  • iTerm a very cool terminal like terminator. An nice configure file.