When Apple shipped Mac OS X Lion 10.7, the “Library” folder located within every user’s home folder, which had previously been visible to users in the Finder, was made invisible. This hint shows how to make the folder visible and keep it that way forever.
As you may know, and as mentioned in this hint, the Library folder can be made visible again by running the following command in Terminal:
/usr/bin/chflags nohidden ~/Library
Apple keeps making the folder invisible again with every System update, so it gets tedious re-running the above script. You can automate this by adding a Login Item with an AppleScript "script application" containing the following code:
do shell script "/usr/bin/chflags nohidden ~/Library"
Read detailed instructions for this hint, and download a ready-made script application file on the Red Sweater Blog.
[kirkmc adds: There are any number of ways to unhide the ~/Library folder. Macworld has an article with 18 different methods, plus a few more in the comments to that article. this hint also tells you how you can add this command to your .profile file so every time you launch Terminal it will run. ]
As SSDs become more common, and prices drop, more and more people are either buying Macs with SSDs, or installing them in their Macs. Personally, I started using an SSD with the first MacBook Air in 2008, and bought my current Mac - a Mac mini, purchased in 2011 - with an SSD. The gains in performance are huge, though the price still makes them a choice that is not for everyone.
So, what about you? Does your main Mac - the one you use most - have an SSD? Feel free to post in the comments to the poll which model, whether you bought it with the Mac or installed it yourself, or any other comments you may have about SSDs.
These AppleScripts are related to this hint. Both can already be found in the replies to the hint topic post, but I'm resubmitting them so that they will appear together.
The first is an improved version of the original AppleScript which presents a dialog box from which a selection of local volumes to be ejected can be made. An example of its usefulness might be that it provides a reliable method for quickly ejecting a MacBook's mounted local volumes for users on the go. I've configured it as a "Run AppleScript" step for an Automator-based Mac OS X Service called "Unmounter" and assigned it the keyboard shortcut of (Command-Control-Shift-E) in System Preferences on my system.
The second is a more robust version of the AppleScript included in my first reply to the original hint topic. It attempts to automatically unmount all unmountable local volumes, and if it finds none, attempts to mount any local volumes that are available. I've configured it as a "Run AppleScript" step for an Automator-based Mac OS X Service called "Toggle Available Local Volumes" and assigned it the keyboard shortcut (Command-Option-Control-Shift-E) in System Preferences on my system.
For both Automator-based Mac OS X Services that I created to provide key triggers for the AppleScripts, the scope specified is "Service receives no input in any application."
set alldisks to paragraphs of (do shell script "df -hlg | awk -F/ '/disk*/ {print $5}'")
set nonbootnumber to (count of alldisks)
try
set alldisks to items 2 thru nonbootnumber of alldisks
activate
set your_selected_device_id to choose from list alldisks with prompt "Please choose one or more volumes to be unmounted." with multiple selections allowed
repeat with the_Item in your_selected_device_id
set the_ID to (do shell script "df -hlg | grep -m 1" & space & quoted form of the_Item & space & "| grep -o 'disk[0-9][a-z][0-9]*'")
try
do shell script "diskutil unmount /dev/" & the_ID
on error the error_message number the error_number
display dialog "Error: " & the error_number & ". " & the error_message buttons {"OK"} default button 1
end try
end repeat
on error the error_message number the error_number
if the error_number is -128 or the error_number is -1708 then
else
display dialog "There are no unmountable volumes." buttons {"OK"} default button 1
end if
end try
set alldisks to paragraphs of (do shell script "df -hlg | awk -F/ '/disk*/ {print $5}'")
set nonbootnumber to (count of alldisks)
try
set all_non_boot_disks to items 2 thru nonbootnumber of alldisks
on error
set all_non_boot_disks to {}
end try
if (count of all_non_boot_disks) > 0 then
try
activate
repeat with the_Item in all_non_boot_disks
set the_ID to (do shell script "df -hlg | grep -m 1" & space & quoted form of the_Item & space & "| grep -o 'disk[0-9][a-z][0-9]*'")
try
do shell script "diskutil unmount /dev/" & the_ID
on error the error_message number the error_number
display dialog "Error: " & the error_number & ". " & the error_message buttons {"OK"} default button 1
end try
end repeat
on error the error_message number the error_number
if the error_number is -128 or the error_number is -1708 then
else
display dialog "There are no unmountable volumes." buttons {"OK"} default button 1
end if
end try
else
set actiondisks to {}
set allvols to paragraphs of (do shell script "diskutil list -plist | grep -o 'disk[0-9][a-z][0-9]*'")
repeat with i in allvols
if i is not in actiondisks then
set actiondisks to actiondisks & i
end if
end repeat
repeat with myitem in actiondisks
try
do shell script "diskutil mountDisk /dev/" & myitem
end try
end repeat
end if
[kirkmc adds: I'm posting this so the final scripts can be easier to find. There were a lot of comments that helped the poster improve on his original submission, and I thank all the users who gave their thoughts on the original script, and the poster who took the time to improve it and re-post it.]
iTunes Smart Playlists don't offer a criteria to find tracks which have been partially played. While "Last Skipped" is an option, this track property may not be set if the track wasn't actually skipped and was merely stopped.
However, if a track's "Remember playback position" option is set (and most audiobooks have this set by default) the track's AppleScript bookmark property will contain the number of seconds that a track has advanced before being stopped. Thus, any track with a bookmark value greater than zero would have been partially played.
Here is an AppleScript that will copy all the tracks in the "Books" library to a new playlist named "Partially Played". Each time it is run it will update the "Partially Played" playlist.
If you press the Option key, then press certain dedicated keys on the standard Apple keyboard, preference panes will open. This works for Mission Control (Option-F3 or Option-F4), Displays (Option-F1 or Option-F2), and Sound (Option-F10, Option-F11 or Option-F12). The F keys in question are those which act on the given features, either displaying Dashboard or Mission Control (F3 and F4), decreasing or increasing brightness (F1 and F2), or changing or muting volume (F10, F11 and F12). If you use a laptop, you may need to press the Fn key together with the other keys to open these preference panes.
I recently tried to drag from Safari's Downloads popup and found that if you drag from the icon of the downloaded file, you can move it where you want.
Click on an icon in the Downloads popup and drag it to any folder, or even onto a Dock icon to launch a file you've just downloaded with a specific application.
I use Terminal everyday, and I find it a good idea to log everything I you. It makes it much easier to undo your mistakes when you know what those mistakes were. Here's how I do this:
Open Terminal's preferences.
Go to Settings, then Shell. You can choose here to run a command at startup. You could create a simple log of your session using the following:
/usr/bin/script ~/Desktop/Terminal.log
This will log everything you do and append it to the log file.
I like to keep my history so instead I wrote this small script that archives previous sessions by renaming the file with a date/time string. I then set Terminal.app to run at startup the following command:
~/Desktop/logger.sh
Here's the script:
#!/bin/bash
# logger.sh
# Log everything you do in Terminal.
#* Formatted date & time string.
FORMATTED_DATE=`/bin/date "+%Y-%m-%d%H%M%S"`
#* Archive the previous file
/bin/cp -f ~/Desktop/Terminal.log{,.$FORMATTED_DATE.txt}
#* Begin a new one
/usr/bin/script ~/Desktop/Terminal.log
[kirkmc adds: This is a good idea. I don't use Terminal a lot, but I find that I sometimes need to remember a command I ran in the past which is no longer in my history.
Also, this is similar to something I do with texts I write. I do most of my writing in BBEdit, and I have a number of "scratch" files which I change every year. For example, I have one file for most of what I write, another just for Mac OS X Hints, and another for a specific client I write for. I archive these files at the end of the year, and create new ones. If I ever need to go back to these files to look for something I can do so. I don't bother to enter dates - which I could do easily enough with a TypeIt4Me shortcut - but if I'm looking for something I'll generally know what text to search for.]
Combining some findings from a recent hint and on Apple's forums, I've finally found a way to disable the annoying rubber-band scrolling in most applications. All the credit goes to those guys as they did the initial investigation.
It works in applications like:
Finder
Mail
Preview
TextEdit
Xcode
and probably in most applications that use the standard UI (the string to be used in defaults appears in AppKit.framework). It doesn't work in Safari or iTunes.
This hint solves a long standing problem when playing classical music on an iPhone. When using the iPhone Music app (iOS 5.1), the full entry (e.g. name of artist, album or song title) for an item can be too long to be displayed. Tap and hold entry to see the full entry pop up. Tap and drag your finger down the list to make the pop up change as you drag. This works for album titles, song titles, and artists names.
[kirkmc adds: Nice. I hadn't heard of this before, but searching the web shows that it is not totally unknown. Since it hasn't shown up here before, it's worth posting.]
If you use Lion Server, and its wiki server, you may find it useful to use custom URL protocols for internal documents and links. Apple has published a technical note explaining how to do this. This document explains how to create the necessary configuration file - /etc/collabd/filter_whitelist.plist - for any custom URL protocol you wish to use.