brew install coreutils du -hs * | gsort -rh
1: Set the Default Application for a Specific File in Mac OS X
This provides file-specific control over default applications, meaning you can have a document or two that open in one app, while the overall general file type defaults to open in another application. For example, you could set one single PSD file to always open exclusively in Pixelmator, while all other PSD formatted documents continue to open in Adobe Photoshop.
- From the OS X Finder, right-click (or Control+Click) on the file to change the default app for and hold down the OPTION key so that the “Open With” menu becomes “Always Open With”
- Continue to hold OPTION and select the application you want to set as the default for this file
The file will open in the application you selected, and that file will now associate the chosen application as it’s new default to always open within.
By the way, if you’re setting a file type this way and notice duplicate entries in that Open With menu, you can remove those duplicate entries with this quick trick to clean up the Open With contextual menu.
Again, this is specific to the file you chose, and this method will not apply to all files sharing that same file format. If you want to set the default application universally for a file type, that’s what the next tip is for.
2: How to Set Default Applications to Open All Files of a Format Type in Mac OS X
This approach will change the default application universally for all files of a specific format. For example, you could use this to set all files of the type PNG to open within Skitch, all TXT files to open with TextWrangler, and all ZIP files to open with The Unarchiver.
- From the Mac file system, select a file of the general format type you wish to change the default application for
- Pull down the “File” menu and choose “Get Info” (or hit Command+i) to access the Get Info window
- Click the “Open with:” sub menu, then click on the contextual menu and select the new application to associate all files of this format type with
- Click the “Change All” button and confirm the change when requested
- Close out of Get Info, repeat for other file format types if necessary
(Note: if the Change All button is greyed out and unclickable it’s because you have not set an application that is different than the currently set default app. Use the pulldown menu to choose the new application for the Change All button to be usable and to apply the adjustment to all files of the file format type)
This change carries throughout all files of that format used within Mac OS X for the active user account, and the filetype-to-application association will stay in place until it has been changed again through the same “Get Info” trick, or until a third party application claims the file format and associates with it directly.
You’ll find this one particularly useful if a newly installed application has assumed control over a file format, like what often happens with Adobe Reader claiming all PDF documents. This ‘Change All‘ trick will allow you to quickly reclaim PDF file types to reopen again in Preview (or your app of choice), which is typically much faster than launching such files in more resource heavy apps like Reader.
The video below demonstrates the latter trick, changing the default application for all files of a given type:
找到thrift 0.9.2 的commit，checkout出来
直接brew install thrift.rb
Mac Tips For iOS Developers
In a previous post I mentioned iTerm2 as a Mac OS X terminal replacement . Hopefully you’ve taken the time to check it out. If so, and you appreciate all it has to offer, the next step is to find a means to easily open iTerm2.
I have a number of scripts (Applescript code) that I have written and saved as applications. I then add the application to the toolbar in Finder. My toolbar looks as follows, all of the icons in the green box I’ve added:
Let me walk you through the steps to create a script that will open a new iTerm2 window and change to the current Finder path. I’ll also show you how to create an icon for the application so it is easy to recognize in Finder.
First, open up the AppleScript Editor and copy/paste the code below (code courtesy Stefan van den Oord):
-- Stefan van den Oord, 2010-12-29 -- The "cd to" command for iTerm2 tell application "Finder" set _cwd to POSIX path of ((folder of (front window)) as alias) end tell tell application "iTerm2" activate try set _session to current session of current terminal on error set _term to (make new terminal) tell _term launch session "Default" set _session to current session end tell end try tell _session write text "pushd \"" & _cwd & "\"" end tell end tell
– Save the file as an application.
Before we drag/drop the application onto Finder, let’s create an icon for the application.
– Go to Iterm2 and use the Mac copy to clipboard feature (shift-command-4) to copy the logo.
– Open the screenshot in Preview, mark the image (control-a) and copy to clipboard (control-c).
– Find the application you saved above, right click and select Get Info .
– Tap the icon in the upper left corner and paste the saved image (control-v).
You now have Applescript that has been saved as an application, with a shiny new icon.
The final step is to drag the application onto the Finder toolbar.
You are good to go, iTerm2 at the current Finder path, one click away.
see other solutions